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
Solved! Go to Solution.
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:
Try using generalize on the features first. That should turn your curveRings into segmented lines.
@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)
Hi, thanks for the reply!
Will this generalize the whole geometry or just replace the curve with vertices?
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.
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.
@MaximeDemers , so what is wrong with having the curves replaced by vertices with the geojson export?
@David_Brooks The arcpy.conversion.FeaturesToJSON throws a 999999 Error when used on layer that has curves.
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 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!