Using ArcPy (Python 3), I am trying to create points along a line where the elevation changes by 1 ft. I was successfully able to convert my stream to 3D using a Water Surface Grid and the Interpolate Shape tool. When I try to print the Z coordinate I get this error:
TypeError: 'float' object is not iterable
import arcpy
import os
from arcpy import env
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("3D")
arcpy.CheckOutExtension("Spatial")
env.workspace = r"I:\1006\GIS\Tools\BFE_Tool\BFE_Tool.gdb"
streams = 'ShadrackChannel'
print ('Interpolating shape...')
stream3D = arcpy.InterpolateShape_3d(r'I:\1006\GIS\Tools\BFE_Tool\Test_Data\wsg100x', streams, 'ShadrackChannel_3D')
print ('Interpolate shape done!')
print ('Looping through polyline....')
# Enter for loop for each feature
for row in arcpy.da.SearchCursor(stream3D, ["OID@", "SHAPE@Z"]):
# Print the current polygon or polyline's ID
print("Feature {}:".format(row[0]))
partnum = 0
# Step through each part of the feature
for part in row[1]:
# Print the part number
print("Part {}:".format(partnum))
# Step through each vertex in the feature
for pnt in part:
if pnt:
# Print z coordinates of current point
print("{}".format(pnt.Z))
else:
# If pnt is None, this represents an interior ring
print("Interior Ring:")
partnum += 1
print ('Done!')
Also how can I create a point where the elevation changes every 1 foot?