# QGIS - Find point position on line (lengthwise)

I have a line layer with some lines, and a point layer whose points are located on those lines.

Now I need to get the position "along" the line where each point is (as in distance from start of the line along the line)

• A point located at the start of the line would be at `0 meters` from start
• A point at the end of the line would be at `<length> meters` from start
• A point anywhere in between would be calculated accordingly

I found two answers that can surely help me achieve this, but they're using Python, and I'm almost sure there is a very simple button or processing tool that would do this instead.

You can use the field calculator on the POINT_Layer. I don't think there is a one-click tool.

``````line_locate_point(aggregate('YOUR_LINE_LAYER_NAME','collect',\$geometry),\$geometry)
``````

EDIT - Based on comment by she_weeds

The difference between the two methodes `aggregate/collect` and `overlay_nearest` can be seen if you have two lines in the line layer.

`aggregate/collect` count the distance along both lines and `overlay_nearest` starts with 0 at the beginning of each line.

``````line_locate_point(overlay_nearest('YOUR_LINE_LAYER_NAME',\$geometry)[0], \$geometry)
``````

• An alternative to this is using `line_locate_point(overlay_nearest('YOUR_LINE_LAYER_NAME',\$geometry)[0], \$geometry)` so that each point has its distance measured along the closest line, rather than a collection of all the line layers' features Commented Jan 22 at 21:31
• @she_weeds tried to improve answer on your comment Commented Jan 22 at 22:18
• Any way to return this in meters? (my current projection is in degrees) Commented Jan 23 at 13:36
• @DanielMöller you would be much better off using a projected CRS to begin with, but if you must work in degrees, you could adapt the expression by wrapping any instance of `\$geometry` with `transform()` to convert from a degree-based CRS to an appropriate meter-based CRS. Commented Jan 24 at 22:45