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).

Mapperz
50.6k9 gold badges76 silver badges133 bronze badges
asked Feb 24, 2012 at 16:14
2
  • 1
    Run SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT - docs.oracle.com/cd/B10501_01/appdev.920/a96630/… returns The context of the error (the coordinate, edge, or ring that causes the geometry to be invalid) Commented Feb 24, 2012 at 16:42
  • I would be good, if it is in java api. Commented Feb 24, 2012 at 17:01

2 Answers 2

0

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

answered Mar 4, 2012 at 20:31
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.

answered Jun 9, 2022 at 13:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.