2 Replies Latest reply on Feb 14, 2012 4:22 PM by 813263

    polygons - array clockwise

    813263
      Hi,

      In Oracle spatial 10g, we are having few millions of circular arc polygons (simply polygon, no interior polygon) "sdo_geometry (2003, null, null, sdo_elem_info_array (1, 1003, *2*)," and are finding the whether the user gps locations falling in any of these polygons (POI in polygon) . We are storing the vertices array in counter clockwise direction.

      Now, we are going to buy POIs (sdo_geometry (2003, null, null, sdo_elem_info_array (1, 1003, *1*)) just straight line connected polygons, no interior poygons.

      The problem here is, the third party poi may have vertices in clockwise or counter clockwise directions.

      Whether loading the third party's poi will impact my current table having circular poly in counter clockwise directions and calculating the Point in polygon?

      Is there any best practice to be followed here.
        • 1. Re: polygons - array clockwise
          Paul Dziemiela
          Hi unnamed user 810260,

          Oracle Spatial defines a valid outer ring as counter-clockwise, no ifs ands or buts about it. Getting your rings into this orientation is your responsibility either by not accepting backwards polygons or by running SDO_UTIL.RECTIFY_GEOMETRY (or SDO_MIGRATE.TO_CURRENT) on each polygon you bring into Oracle Spatial.

          A reference might be similar issues surrounding importing WKT into Oracle Spatial
          SDO_UTIL.FROM_WKTGEOMETRY seems ignorant of ring rotation
          The OGC spec for WKT does not specify a ring rotation so your average WKT polygon could have rings going either way. As Dr. Ravada responds in that thread, it our problem to fix it. The generic WKT utility for Oracle Spatial just loads whatever its given however the rings are rotated and does not attempt to fix anything.

          So a best practice might be to rectify everything. I am not really a big fan of rectify myself (search the list for folks talking about NULL output). Rather I just test the ring rotation and reverse it if I find the problem.

          Cheers,

          Paul
          • 2. Re: polygons - array clockwise
            813263
            Hi Paul,

            Thanks for your time & response, it really helped me to proceed further.