I have a points layer that came from a flight path and I want to calculate the distance between each point sequentially. Ideally I'd need a solution that is do-able inside Graphical Modeler, and doesn't require any extra plugins etc.

I've looked at some of the other answers but nothing has solved this for me.

The flight path loops back on itself multiple times (i.e. it's not a straight line) so I can't use nearest neighbour.

  • 1
    Are the points ordered somehow, so is there a field that can be used to identify in which order they have to be connected: current point, next one etc.?
    – Babel
    May 28, 2021 at 9:43
  • Yes there is an id field called 'fid' that goes from 0-n May 28, 2021 at 9:45

1 Answer 1


Calculate the length of the line from each point to the next point, i.e. the point with the id that is 1 higher than the current id. Use this expression to do that - in line 7 replace id with the name that contains your order-numbers:

length (
    make_line (
        geometry (
            get_feature_by_id (

Screenshot: the red points are connected for visualization purpose with geometry generator and the same expression as above, minus the length () function:

enter image description here

  • Thank you so much, this worked fantastically! For some reason I had to make the layer permanent but otherwise much obliged. May 28, 2021 at 10:09
  • Strange - worked for me with temporal layer, as you can see on the screenshot. But great to hear that it worked.
    – Babel
    May 28, 2021 at 10:12

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.