# Replace curve rings by vertices

2652
12
08-31-2021 06:57 AM
Regular Contributor

Hi,

Is there a way to replace curve rings in polygon geometries with vertices along the curve using arcpy?

I need to output a specific json of a featureSet but curveRings are not allowed.

Is there a mathematical function that can be used?

Thank you for the info!

Maxime Demers

Tags (3)
1 Solution

Accepted Solutions
by
MVP Esteemed Contributor

What's the precision of your dataset? Just use that for the tolerance. Using such tiny tolerances retains the non-curved data such that checking whether the original and generalized shapes of non-curved geometry returns "True".

Here's a sample of generalizing non-curved geometry:

- Josh Carlson
Kendall County GIS
12 Replies
by
MVP Esteemed Contributor

Try using generalize on the features first. That should turn your curveRings into segmented lines.

- Josh Carlson
Kendall County GIS
MVP Regular Contributor

@MaximeDemers , if you're wanting a script, trying the following, which you can set up as a script with 3 parameters:

`import arcpyinFC = arcpy.GetParameterAsText(0)tolerance = arcpy.GetParameterAsText(1)outJSON = arcpy.GetParameterAsText(2)arcpy.management.CopyFeatures(inFC, r"memory\outFC")arcpy.edit.Generalize(r"memory\outFC", tolerance)arcpy.FeaturesToJSON_conversion(r"memory\outFC", outJSON)`

David
..Maps with no limits..
Regular Contributor

Hi, thanks for the reply!

Will this generalize the whole geometry or just replace the curve with vertices?

by
MVP Esteemed Contributor

The generalize function will apply to the entire layer. However, even an extremely small tolerance like 0.1 will break up the curves, while largely leaving the rest of the data unaltered.

- Josh Carlson
Kendall County GIS
Regular Contributor

That could be a problem because the topology and the precision is important. There must be another way. For instance when you output a geojson, the curves are replaced by vertices because curves are not in the spec of geojson.

MVP Regular Contributor

@MaximeDemers , so what is wrong with having the curves replaced by vertices with the geojson export?

David
..Maps with no limits..
Regular Contributor

@David_Brooks The arcpy.conversion.FeaturesToJSON throws a 999999 Error when used on layer that has curves.

by
MVP Esteemed Contributor

What's the precision of your dataset? Just use that for the tolerance. Using such tiny tolerances retains the non-curved data such that checking whether the original and generalized shapes of non-curved geometry returns "True".

Here's a sample of generalizing non-curved geometry:

- Josh Carlson
Kendall County GIS
Regular Contributor

@jcarlson yes using a very small float preserve the precision. I think it's the best solution because I rather not write to an intermediate format.

Thanks for your help!