Finding Ellipses in a polygon feature class?

886
2
Jump to solution
05-09-2018 12:47 PM
Steve_Salas
Occasional Contributor

I recently had difficulty running the geoprocessing tool Find Identical (arcpy.FindIdentical_management) in ArcMap - it was crashing with the unhelpful "999999: Error executing function."  I eventually eliminated possibilities down to two very small ellipse polygons (as opposed to our typical multi-vertex polygons).  Once i eliminated these two polygons, the tool ran fine on the remaining 200,000+ features.

I didn't find anything particularly helpful in the ST_Geometry functions (Oracle) that would help me query for an ellipse polygon next time I need to determine if I have some in my data.  Even sde.st_astext(shape) spits out a significant list of coordinate pairs that I would guess would be the ellipse if generalized to multiple vertices.

A rather clumsy method in geoprocessing is to run the Feature Vertices to Points tool ("All" option) and summarize the output on the original feature identifier - ellipses appear to return only two output points (start and end point) opposed to the 3 or more points from a valid polygon composed of vertices.

Is there a better way to select records that use ellipse (and circle) types for their geometry?  I'm not a ArcObjects programmer but that might be an alternative there if not in SQL or ArcPy?  Thanks for any ideas!    -S.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Although Esri's Geometry objects—Common Data Types | ArcGIS for Developers support circular arcs, elliptical arcs, and Bezier curves, there is a catch when it comes to enterprise geodatabases.  Esri's curved shapes are not always stored natively in the spatial data column.  Depending on the DBMS and spatial data type, Esri's curved shapes are stored in a separate field in a separate table, and what is stored in the base table's spatial data column is a linear approximation of the curved shape.  This is why your sde.ST_AsText is returning the long list of coordinates you are seeing.

Given the variablitiy of how Esri's curved shapes are handled in different DMBSs and spatial data types, I recommend using an ArcPy cursor to retrieve the true Esri shape and then test it for circular arcs, elliptical arcs, and Bezier curves.

Something like the following should work:

fc = # feature class to check for curved polygons
with arcpy.da.SearchCursor(fc, ["OID@", "SHAPE@JSON"]) as cur:
    oid_list = [oid for oid,json in cur if json and "curveRing" in json]
print(oid_list)

If oid_list is empty, there are no curved polygons.

View solution in original post

2 Replies
JoshuaBixby
MVP Esteemed Contributor

Although Esri's Geometry objects—Common Data Types | ArcGIS for Developers support circular arcs, elliptical arcs, and Bezier curves, there is a catch when it comes to enterprise geodatabases.  Esri's curved shapes are not always stored natively in the spatial data column.  Depending on the DBMS and spatial data type, Esri's curved shapes are stored in a separate field in a separate table, and what is stored in the base table's spatial data column is a linear approximation of the curved shape.  This is why your sde.ST_AsText is returning the long list of coordinates you are seeing.

Given the variablitiy of how Esri's curved shapes are handled in different DMBSs and spatial data types, I recommend using an ArcPy cursor to retrieve the true Esri shape and then test it for circular arcs, elliptical arcs, and Bezier curves.

Something like the following should work:

fc = # feature class to check for curved polygons
with arcpy.da.SearchCursor(fc, ["OID@", "SHAPE@JSON"]) as cur:
    oid_list = [oid for oid,json in cur if json and "curveRing" in json]
print(oid_list)

If oid_list is empty, there are no curved polygons.

MichaelVolz
Esteemed Contributor

Thanks for the code snippet to find curved polygons.

0 Kudos