I have a points layer and a multi-part non-overlapping line layer (a line divided into segments). All the points fall exactly on the line. I have the coordinates of the start and endpoint of each segment stored in the segment layer. I want to calculate the distance of each point from the starting point of the segment on which it lies.

In the attached figure, the orange line is the track which is segmented at black lines. The number in red is the FID of each segment. All Green points fall on the line. I want to find the distance of each point from the start/end of a segment (any direction will do).

enter image description here

  • after posting my answer I realised, you did not mention the software. Are you working with ArcGIS?
    – EikeMike
    May 10, 2017 at 5:46

2 Answers 2


You can use linear referencing to add the distance along a line to point features. It is possible add mesaures to lines like the kilometrage of a road. Later you can query this M-values with points.

  1. Create a line feature (no multipart) with an ID with Multipart to single part.
  2. Add an ID-field to your points, which you probably did already.
  3. Use the tool Create Routes of the linear referencing toolbox with the line feature to create a route. Routes have M-values in addition to x and y. As measure source use LENGTH, to add the distance from the start point of the line segments as M-Values.
  4. Now you can use the points and the just created route with the tool Locate Features Along Routes. With this tool you can add M-values of a routes (in our case: the distance from the start point of the line segments) to points.

As output you get a table with the point-IDs and the corresponding line-ID and line distance from start of each segment (M-Value).

(works with basic license, tested with 10.0 and 10.2)

EDIT because of comment:

You somehow need to identify the lines with "wrong" direction.

    • Draw an arrow at the and search visually for double arrows in the view or
    • You can convert the lines to endpoints. (Feature Vertices To Points, ArcInfo-license) and look for double points.

Create two new [double] fields: MeasFrom and MeasTo. Use fieldcalculator to set MeasFrom to 0 and MeasTo to lenght of the line. For lines with "wrong" direction you set MeasFrom to lenght of the line and MeasTo to 0.

As before, you can use the tool Create Routes of the linear referencing toolbox. This time use TWO_FIELDS as measure source and choose the fields MeasFrom and MeasTo as sourcefields. After creating the Route you use again Locate Features Along Routes.

  • Thanks for the response Mike. It works but some of my route is not as straight as it looks like in the figured. It's a 173 mile track and the route is in a zig-zag pattern, so sometimes the starting point of the segment is chosen along one direction and sometimes in the opposite direction. Is there a way to account for that. Let me know what else do you need for the problem description. May 26, 2017 at 23:01
  • See edit above.
    – EikeMike
    Jun 13, 2017 at 7:17

You do not state what your license level is, you should always state that as that dictates the solution. In this case the solution requires an Advance license level.

A simple model with an iterator looping over your line segments will do. Each segment then selects the points and you feed that into the point distance tool.

Your "from" point would come from the from end of your line segment. You can use Feature Vertices To Points tool to extract that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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