ArcPy: Edit vertex without removing true curves

1244
6
02-03-2022 09:53 PM
Status: Open
Labels (1)
Bud
by
Notable 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)
                    points.append(point)
                parts.append(points)
            row[0] = arcpy.Polyline(parts, spatial_reference)
            cursor.updateRow(row)

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


Before running script:

Bud_3-1643953604735.png

After running script:

Bud_5-1643953681539.png


Idea:

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.



6 Comments
AlexMarkov
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.
RichardFairhurst
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.
Bud
by

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.

Thanks.

HannesZiegler
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.

Bud
by

@HannesZiegler 

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.

HannesZiegler

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).