<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SDO_GEOMETRY polygon: Vertices are clockwise in ArcMap, but counterclockwise in SQL in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181379#M7694</link>
    <description>&lt;P&gt;From the &lt;A href="https://developers.arcgis.com/documentation/glossary/polygon/" target="_blank" rel="noopener"&gt;Glossary&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;[...] Each ring in a polygon contains an array of&amp;nbsp;&lt;/SPAN&gt;point&lt;SPAN&gt;&amp;nbsp;coordinates, where the first and last point are the same. [...] To create a topologically correct polygon, exterior rings are oriented clockwise, and interior rings (holes) are oriented counter-clockwise. [...]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;And from the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/polygon.htm" target="_blank" rel="noopener"&gt;arcpy doc on Polygons&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;During the creation of a geometry object, a simplification process is performed to make the geometry topologically consistent according to its geometry type. For instance, it rectifies polygons that may be self-intersecting, or contain incorrect ring orientations.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;That suggests that&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;the vertex order in ArcGIS and Oracle is different&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;ArcGIS reverses the vertex order if you draw a counter-clockwise polygon (it does)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;the edit vertices tool hides the last vertex (it can be seen using Python or Arcade)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Thu, 09 Jun 2022 08:07:28 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-06-09T08:07:28Z</dc:date>
    <item>
      <title>SDO_GEOMETRY polygon: Vertices are clockwise in ArcMap, but counterclockwise in SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181347#M7692</link>
      <description>&lt;P&gt;I've created a polygon in an Oracle 18c SDO_GEOMETRY FC via ArcMap.&lt;/P&gt;&lt;P&gt;In ArcMap, the vertices are displayed in the direction that I drew them: clockwise.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1654742997951.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/43078i3DE47264A381DE60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1654742997951.png" alt="Bud_0-1654742997951.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, if I query the data via SQL, then the vertices are listed in &lt;U&gt;counter&lt;/U&gt;clockwise order:&lt;/P&gt;&lt;PRE&gt;select&lt;BR /&gt;    t.x,&lt;BR /&gt;    t.y&lt;BR /&gt;from&lt;BR /&gt;    sdo_polygons p&lt;BR /&gt;cross join&lt;BR /&gt;    sdo_util.getvertices(p.shape) t --https://stackoverflow.com/q/72590279/5576771&lt;BR /&gt;&lt;BR /&gt;ID  X   Y&lt;BR /&gt;-- --  --&lt;BR /&gt;1  10  10&lt;BR /&gt;2  20  10&lt;BR /&gt;3  20  20&lt;BR /&gt;4  10  20&lt;BR /&gt;5  10  10&lt;/PRE&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;Why is there a difference in the vertex order — between ArcMap and SQL?&lt;BR /&gt;Are two different sets of vertices stored within a single feature?&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;Related:&lt;/P&gt;&lt;P&gt;I happen to be aware of an Oracle error message that suggests that SDO_GOMETRY polygons need to be counterclockwise:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://docs.oracle.com/en/database/oracle/oracle-database/21/errmg/ORA-12700.html#GUID-E6873876-0D0A-456E-B89B-F5A2E41F0638:%7E:text=polygon%20boundary%20is%20not%20closed" target="_blank" rel="nofollow noopener noreferrer ugc"&gt;ORA-13367:&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;wrong orientation for interior/exterior rings&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cause: In an Oracle Spatial geometry, the exterior and/or interior rings are not oriented correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Action: Be sure that the &lt;STRONG&gt;exterior rings are oriented counterclockwise&lt;/STRONG&gt; and the interior rings are oriented clockwise.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://community.oracle.com/tech/apps-infra/discussion/4499495/why-do-polygon-vertices-need-to-be-counterclockwise" target="_self"&gt;&lt;SPAN&gt;Oracle Spatial Community: Why do polygon vertices need to be counterclockwise?&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/119150/order-of-polygon-vertices-in-general-gis-clockwise-or-counterclockwise" target="_self"&gt;&lt;SPAN&gt;GIS SE: Order of polygon vertices in general GIS: clockwise or counterclockwise&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 05:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181347#M7692</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-06-14T05:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: SDO_GEOMETRY polygon: Vertices are clockwise in ArcMap, but counterclockwise in SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181379#M7694</link>
      <description>&lt;P&gt;From the &lt;A href="https://developers.arcgis.com/documentation/glossary/polygon/" target="_blank" rel="noopener"&gt;Glossary&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;[...] Each ring in a polygon contains an array of&amp;nbsp;&lt;/SPAN&gt;point&lt;SPAN&gt;&amp;nbsp;coordinates, where the first and last point are the same. [...] To create a topologically correct polygon, exterior rings are oriented clockwise, and interior rings (holes) are oriented counter-clockwise. [...]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;And from the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/polygon.htm" target="_blank" rel="noopener"&gt;arcpy doc on Polygons&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;During the creation of a geometry object, a simplification process is performed to make the geometry topologically consistent according to its geometry type. For instance, it rectifies polygons that may be self-intersecting, or contain incorrect ring orientations.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;That suggests that&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;the vertex order in ArcGIS and Oracle is different&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;ArcGIS reverses the vertex order if you draw a counter-clockwise polygon (it does)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;the edit vertices tool hides the last vertex (it can be seen using Python or Arcade)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 09 Jun 2022 08:07:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181379#M7694</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-06-09T08:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: SDO_GEOMETRY polygon: Vertices are clockwise in ArcMap, but counterclockwise in SQL</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181891#M7695</link>
      <description>&lt;P&gt;Shapefile uses right-hand rule*, but geodatabase uses left-hand rule*. Some storage formats have a required order (e.g., SDO, KML), but others&amp;nbsp;(GML) are flexible.&amp;nbsp;Since the sketch code originated in ArcView, and it was based on shapefile, it's likely that sketch would use right-hand rule, as does ArcObjects in general (and therefore ArcPy).&lt;/P&gt;&lt;P&gt;The SgShape library used by all Esri tools allows for extraction in either order, but at geometry assembly it will flip rings, demote interior rings, and promote exterior rings (as necessary) so that the geometry is internally consistent with left-hand rule. The only time vertices are stored twice is if a CAD entity is present.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;* The "right-hand rule" where, when walking the perimeter, the right hand is toward the inside (aka, clockwise on exterior rings and counter-clockwise on&amp;nbsp; interior), not the "right-hand rule" where, when the right thumb is pointed up from the face of the ring, the curl of fingers indicates the vertex order direction (that's called "left-hand rule").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 15:11:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sdo-geometry-polygon-vertices-are-clockwise-in/m-p/1181891#M7695</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2022-06-10T15:11:01Z</dc:date>
    </item>
  </channel>
</rss>

