Replace curve rings by vertices

1207
12
Jump to solution
08-31-2021 06:57 AM
MaximeDemers
Occasional Contributor III

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)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Notable 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:

jcarlson_1-1630422476967.png

 

- Josh Carlson
Kendall County GIS

View solution in original post

12 Replies
jcarlson
MVP Notable Contributor

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

- Josh Carlson
Kendall County GIS
0 Kudos
David_Brooks
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 arcpy

inFC = 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..
0 Kudos
MaximeDemers
Occasional Contributor III

Hi, thanks for the reply!

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

0 Kudos
jcarlson
MVP Notable 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
0 Kudos
MaximeDemers
Occasional Contributor III

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.

0 Kudos
David_Brooks
MVP Regular Contributor

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


David
..Maps with no limits..
0 Kudos
MaximeDemers
Occasional Contributor III

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

0 Kudos
jcarlson
MVP Notable 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:

jcarlson_1-1630422476967.png

 

- Josh Carlson
Kendall County GIS
MaximeDemers
Occasional Contributor III

@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!

0 Kudos