Skip to main content
1 of 6
GeoSharp
  • 3.3k
  • 18
  • 28

This can be a bit tricky if the values are in the shape field. Here is a python and arcpy code snippet for how to access the z-values of a specific line in a polyline.

id_field = 'TARGET_FID' #field identifies which features that need to be shifted
id_value = 12 #value in id_field that identifies features that need to be shifted
shift_value = 2
with arcpy.da.UpdateCursor("Breaklines", ['SHAPE@', id_field]) as u_cur:
    for row in u_cur:
        if row[1] == d_value:
            geometry = row[0]
            pts = geom.getPart(0) #get polyline geometry
            pt_array = arcpy.Array() #create array to house new points
            for pt in pts:
                pnt.Z += shift_value #shift z value
                pt_array.add(pt) #add point to array
            new_polyline_geometry = arcpy.Polyline(pt_array, None, True) #important to enable z-value by having the third parameter set to True
            row[0] = new_polyline_geometry #set row[0] which is SHAPE@ (geometry object)
            u_cur.updateRow(row)
GeoSharp
  • 3.3k
  • 18
  • 28