As shown in the picture below I would like to calculate the path length of each point from the start. Can anyone give me some help in writing this in python for ArcGIS?
So, you have a point feature class. Every point has a unique attribute that represents the sequence (e.g., from 1 to 100). You want to get a point with PointID = 1, find a distance to the point with PointID = 2, and write this distance value into the Distance field in the feature class (Distance field for feature PointID2 will contain the distance from PointID1 to PointID2). This solution would work for Basic license.
The UpdateCursor will write the length value to the field. It is important to order the point features in the sequence you want to calculate the length with (you cannot rely on the OID since those might not match the order of features creation). Here is the sample result: | |||||||||||||||||||||
|
I have made a tool that does this measurement. This tool needs only three parameters: Just download the Measure_Length.tbx and locate in the ArcCatalog and run.
Please find the tool in the github at here.
| ||||
Thank you ->SIslam, Ur code is very helpful. Then i tried to revised the code to fit my process, the revision as below: import arcpy from arcpy import env
But it not work properly just like pic show below, u can see the all length is 0.0. The original point data has more 4000 points like the pic below. | |||||||||||||||||
|