Select to view content in your preferred language

Identify Curves in Python with Describe

1214
3
08-28-2012 12:25 PM
Status: Closed
Labels (1)
MichaelVolz
Esteemed Contributor
It would be great if python could identify curves in polylines and polygons with the describe function.  I have several applications where curves (Bezier curves) need to be densified for the tools (widgets) in the applications to work correctly.  When processing this data it would be nice to be able to log all the features that needed to be densified because they had Bezier curves, especially if a feature caused the processing tool to crash so I would be able to focus in quickly on the problematic geometry.

In the forums people have suggested to convert the feature class to a shapefile first and then compare the original feature class to the shapefile to identify the curves, but this is a cumbersome process that seems like it could be simplified if the Bezier curves could just be identified in the original feature class.
3 Comments
DanPatterson_Retired
# --- for posterity, c0 is a polygon circle with a piece cut off
#
import json

c0
<Polygon object at 0x15b885eb860[0x15b87f800a8]>

j = json.loads(c0.JSON)

has_curves = np.any(['curve' in i for i in list(j.keys())])

has_curves
True

Now if you want to count the number of curves, you have to dig into the dictionary a bit more...

Just add this or equivalent to arcpy.da.Describe !!!

HannesZiegler
Status changed to: Needs Clarification

Thank you for sharing your idea for a feature that could identify curves in polylines and polygons with the Describe function. I understand that you have several applications where curves (Bezier curves) need to be densified for the tools (widgets) in the applications to work correctly, and it would be useful to be able to log all the features that needed to be densified because they had Bezier curves.

I wanted to let you know that there is already a <arcpy.geometry>.hasCurves property in arcpy that returns True if the geometry object has curves. This property can be used to check if a feature class has curves or not.

I wanted to know if this satisfies your needs in place of a Describe function?

HannesZiegler
Status changed to: Closed

We are closing this idea, as there is already an <arcpy.geometry>.hasCurves property in arcpy that returns True if the geometry object has curves. If you have any concerns about this decision, please feel free to let us know by responding below. Thank you for you understanding.