I have a long polyline with multiple vertices. i want shape length of only a portion of this polyline. For that I have extracted the coordinates of all vertices of this long polyline and created a list. I have removed the coordinates from this list which are not required, so that i have a list of coordinates only of the portion whose shape length is required.
Now i need to calculate the shape length using this coordinates list. For that i have used the following code:
import numpy as np
def dist_from_point_list(point_list):
line = np.array(point_list, float)
return np.sqrt(np.sum((line[1:] - line[:-1])**2, -1)).sum()
print(dist_from_point_list(point_list))
When I measure the distance in arcgis pro, the shape length is different from what i get using this function in my code. I have to somehow use the spatial reference/ projection information in my code to get the correct spatial length.
Any help in this regard would be highly appreciated. Thanks.