ArcPy: Edit vertex without removing true curves

02-03-2022 09:53 PM
Status: Open
Labels (1)
Frequent Contributor

I have a multipart polyline FC that has true curves (Oracle 18c SDE.ST_GEOMETRY).

I want to update the coordinates of the vertices in the lines via ArcPy — without losing the true curves:

import arcpy
connection = "Database Connections\my_conn.sde"
feature_class = connection + "\my_owner.my_fc"
spatial_reference = arcpy.Describe(feature_class).spatialReference

with arcpy.da.Editor(connection) as edit_session:
    with arcpy.da.UpdateCursor(feature_class, "SHAPE@") as cursor:
        for row in cursor:
            geometry = row[0].densify("ANGLE", 10000, 0.174533)
            parts = arcpy.Array()
            for part in geometry:
                points = arcpy.Array()
                for point in part:
                    point.M = geometry.measureOnLine(point)
            row[0] = arcpy.Polyline(parts, spatial_reference)

The script reconstructs and replaces the geometry of the lines. So, unfortunately, it removes the true curves from the shapes.

Before running script:


After running script:



Could ESRI consider giving us a clean way to edit vertices — without removing the true curves from the SHAPE?
 - I don't want to densify the curves into straight segments...I want to keep the true curves.
 - It would be ideal if there were a clean way to do this; not a workaround like converting to JSON and parsing out the curve info from the JSON text (would be messy/fragile).

For example, a simple method like this would be helpful:

UpdateVertex (shape, partNum, vertexNum, [z, m]) 
#It wouldn't replace the shape or replace the vertex. It would *update* a coordinate in the vertex.
#So the true curves would remain intact.

Some geometries in ArcGIS are created like parametric elements (arcs, ellipses).

It should be able to get this information somehow from the properties of arcpy.Geometry, arcpy.Polyline, arcpy.Polygon classes.
For performance reasons only coordinate values are actually readable from the arcpy.geometry operators.  Geoprocessing deals with the parametric elements, but not the arcpy geometry operators.  At the users conference the programmers said it had to do with optimizing online performance, which was a key design requirement for arcpy.  They recognized that you will screw up geometry if you use arcpy operations on parametric data, but offered no solution.

Merged from a separate idea:

Currently, there isn't a way to directly access a polyline's true curve information.

We're aware that it's technically possible to access true curves indirectly via JSON. But that requires parsing the JSON text to grab the true curve info, which is slow and messy.

It would be helpful if we had a cleaner way to access curves.


Status changed to: Needs Clarification

Thank you for your suggestion regarding a cleaner way to access true curves in a polyline through an ArcPy property. We understand you feel the current method of accessing the information indirectly through JSON can be improved. To better understand your idea, could you please clarify if you are looking for a way to determine whether or not the geometry has curves? If so, this is already offered using the hasCurves property of geometry objects. Or are you looking for a similar property, but for accessing and manipulating the actual curve information rather than just confirming its existence? We appreciate feedback from all users visiting the ideas exchange, as it helps us make informed decisions about future updates, and look forward to hearing from you.



Yes, I think this is right:

Or are you looking for a similar property, but for accessing and manipulating the actual curve information rather than just confirming its existence?

In hindsight, my wording wasn't great.


Thank you for clarifying, while looking into this further I noticed you more recently submitted a similar idea, 1250953. We will merge these ideas together. To help us gauge user interest in this idea, please consider giving it a kudo (The author's kudo is not automatically applied).