3

I need to import a huge number of polygons from a third party (as a csv file- array of x,y's). I have to check whether the polygon vertices are in clockwise or counter clockwise, finally i have to convert it into counter clockwise and store it in the oracle spatial table as sdo geometry.

I am not able to find any oracle spatial java API to check the array of vertices and convert it into counter clockwise. I tried the same question in oracle spatial forum, but they said no API for this.

do you have ever worked on this oracle spatial java API, any other thoughts. ( i have found some methods to validate the ring rotation "http://paulbourke.net/geometry/clockwise/index.html", but if it is from oracle it will be good to implement).

2

2 Answers 2

0

EXECUTE SDO_MIGRATE.TO_CURRENT('YOUR_TABLE'); Should correct the orientation of your polygons (10G r2)

1
0

I know this question is ancient, but for anyone else wondering about this scenario:

Maybe the steps would be:

  1. In a query, validate the polygons using sdo_geom.validate_geometry_with_context().
  2. For the polygons that have problems, use the rectify_geometry() function to fix them (within a query).
  3. Store all the polygons (including the rectified polygons) in the final Oracle table as SDO_GEOMETRY.

That's just a guess. I'm not an Oracle Spatial expert.

I know the question asked for a Java solution, and this proposed solution isn't Java. But maybe it's possible to put the data in a temporary db table somewhere, run the SQL queries on it as I suggested, and then INSERT the resulting data into the final table. Maybe it's possible to run those SQL queries from Java code? (execute SQL from within Java)

Or maybe there is a way to use some sort of Oracle DB tool to load the CSV into a temporary table, and then proceed from there?

Or maybe just use a GIS tool like ArcGIS Pro to import the CSV into a temporary Oracle/SDO_GEOMETRY table. Maybe ArcGIS Pro would automatically rectify any problem polygons. Now that I think about it more, I think I like this idea best. Rectifying and loading GIS data is what GIS tools like ArcGIS Pro are good at.

Just some uneducated thoughts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.