I am working on a Modelbuilder project to teach myself how to use it. I do not yet have much knowledge in Python. I am currently a little stuck on the project I am working on.

I have a line made from a .csv file with lat/long values. The line retains the attribute data of the original points.

I am now trying to measure the length of the line at each point, starting from the beginning of the line where the value is zero. In other words, I am looking for the cumulative distance from the start of the line to the end, with values at each point along the line.

  • 1
    Did you use model builder to create the line from CSV? Just take it back a step and create individual lines as well (into in_memory perhaps) and find the length of each and add them up as you go.
    – Midavalo
    Apr 27 '16 at 18:13
  • 2
    You also need to project the point and lines into a Projected Coordinate System to get linear measurements, since lat/long coordinates only create lines with angular units, which make no sense for line measurement. I would do this in Python and if you have ArcGIS 10.3 I would use the queryPointAndDistance method of the polyline geometry after building the line and projecting both the line and the points to use real linear units. Apr 27 '16 at 18:22
  • @RichardFairhurst I do not have much knowledge of Python yet, I just recently started learning the very basics. Is there a way to do this without Python?
    – Duderino
    Apr 27 '16 at 20:34
  • @Midavalo Yes I am only using model builder. I am not sure if that process would work as eventually I will be making a route out of my line that is M-aware. I will give it a try.
    – Duderino
    Apr 27 '16 at 20:38

This is Linear Referencing task, however Python makes it much easier. Solution below assumes your points and line are in projected coordinate system.

Add your line to mxd, call layer "line". Add numeric field to your points table, use advanced mode in field calculator, python and this expression to polulate it:

def Chainage(shp):
 mxd = arcpy.mapping.MapDocument("CURRENT")
 with arcpy.da.SearchCursor(lr, 'Shape@') as cursor:
  for row in cursor:
 L=geom.measureOnLine (shp.firstPoint)
 return L


Chainage( !Shape!)

Understanding what expression does will help you greatly with Python

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.