HOW TO
There is no direct way to insert the start and end elevation of a line feature as attribute values. The Interpolate Shape tool can only add z-values to the feature geometry, and the Add Surface Information tool can only add the mean elevation of a feature by defining the elevation surface. However, it is possible to add the start and end z-values to a line feature as attribute values by combining the Interpolate Shape tool and a Python script.
The instructions provided describe how to add start and end z-values to a line feature.


import arcpy
#Specify the desired workspace.
input_fc = r'<workspace>\<line_feature>'
#Modify this part according to the specified field names created in step 2.
myfield1 = "Z_Start"
myfield2 = "Z_End"
myshape = "SHAPE@"
#Iterate between rows available in the attribute table of the line feature and input the z-values.
with arcpy.da.UpdateCursor(input_fc, (myshape, myfield1, myfield2)) as cursor:
for row in cursor:
geom = row[0]
startpt = row[0].firstPoint
endpt = row[0].lastPoint
row[1] = round(startpt.Z, 2)
row[2] = round(endpt.Z, 2)
cursor.updateRow(row)


Article ID: 000014433
Get help from ArcGIS experts
Start chatting now