I have joined two tables. The first table includes the current z values, while the new table includes new z values. I first tried to snap, but this didn't update the Z values, only X and Y. How can I update the z values of the joined table? I tried some python scripting, but Im not very good at it.
import arcpy
mast = "VoltTotal.GDB\Export_Output"
with arcpy.da.UpdateCursor(mast['test_endre_geom.SHAPE@Z','feat3d.POINT_Z']) as cursor:
for row in cursor:
row[0] = row[1]
cursor.updateRow(row)
Currently I'm getting an error displaying: RuntimeError: A column was specified that does not exist.
Answer
Use cursors and make use of dictionaries to avoid nested loops.
import arcpy
mast = "VoltTotal.GDB\Export_Output"
shapeFile = "PathToMy\test_endre_geom.shp"
di = {}
with arcpy.da.SearchCursor(mast, ['M_FIELD', 'POINT_Z']) as cursor:
for m, z in cursor:
di [m] = z
with arcpy.da.UpdateCursor(shapeFile, ['M_FIELD', 'SHAPE@Z']) as cursor:
for m, z in cursor:
z = di [m]
row = (m, z)
cursor.updateRow (row)
No comments:
Post a Comment