Hello,
I would like to get the maximum hight of a line feature but it doesn't work with FeatureClassToNumPyArray?
I tried the following code:
def Sperren_interpShape(self):
arcpy.CheckOutExtension("3D")
desc = arcpy.Describe(inSperren)
outFC = "{0}_3D".format(desc.basename)
method = "BILINEAR"
# Execute InterpolateShape
arcpy.ddd.InterpolateShape(inHights, inSperren, outFC,
"", "", method, True)
arcpy.CheckInExtension("3D")
arcpy.MakeFeatureLayer_management(outFC, outLyr)
with arcpy.da.SearchCursor(outLyr, "OBJECTID") as cursor:
for row in cursor:
print row[0]
sel = "{} = {}".format("OBJECTID", row[0])
print sel
arcpy.SelectLayerByAttribute_management(outLyr, "NEW_SELECTION", sel)
arr = arcpy.da.FeatureClassToNumPyArray(outLyr, ["OBJECTID", 'SHAPE@Z'])
print arr
print np.amax(arr.astype(np.float))
but it only results in the following print statements:
1
OBJECTID = 1
[(1, nan)]
1.0
What does "nan" means? Are there better ways to get the maximum hight of a 3D line?
Working in 10.6.1?
Solved! Go to Solution.
nan .... Not a Number
FeatureClassToNumPyArray—ArcGIS Pro | Documentation
SHAPE@M and SHAPE@Z tokens will only return values if the in_table contains point features and is m-aware (or z-aware). If the in_table contains polygon, polyline, or multipart features, SHAPE@M and SHAPE@Z will return a nan. Any feature class that is not m-aware or z-aware will not support SHAPE@M and SHAPE@Z tokens.
Convert polyline or polygon features to a point featureclass first
then use explode_to_points=True
FeatureClassToNumPyArray (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {skip_nulls}, {null_value})
nan .... Not a Number
FeatureClassToNumPyArray—ArcGIS Pro | Documentation
SHAPE@M and SHAPE@Z tokens will only return values if the in_table contains point features and is m-aware (or z-aware). If the in_table contains polygon, polyline, or multipart features, SHAPE@M and SHAPE@Z will return a nan. Any feature class that is not m-aware or z-aware will not support SHAPE@M and SHAPE@Z tokens.
Convert polyline or polygon features to a point featureclass first
then use explode_to_points=True
FeatureClassToNumPyArray (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {skip_nulls}, {null_value})