I have a polyline feature dataset with Z coordinates. I'd like to change the Z values (e.g.) by adding 10 meters.
I am trying the following code, but no changes happen. It seems the code is able to enter each part of each polyline and print the Z values plus 10, but I don't know what I have to do to update the Z coordinates.
Here is the code:
import arcpy
gdb = r'C:\Umberto\network_analyst\umbeNETWORK\OfficeBuilding.gdb'
feature = gdb + r'\Transportation\FloorLines'
fields = ["Floor_Number", "SHAPE@"]
# start edit session
edit = arcpy.da.Editor(gdb)
edit.startEditing()
edit.startOperation()
# Create field name with the proper delimiters
#
whereclause = """%s = 3""" % arcpy.AddFieldDelimiters(feature, fields[0])
with arcpy.da.UpdateCursor(feature,fields, whereclause) as cursor:
for row in cursor:
polyline = row[1]
for part in polyline:
for pnt in part:
pnt.Z = pnt.Z + 10
print pnt.Z
cursor.updateRow(row)
# stop esit session
edit.stopOperation()
edit.stopEditing(True)