Using QGIS, I have a task for which I need to combine 2 point layers (with x-y coordinates in it). I managed to combine the points but they are only straight and I want them to follow the street pattern.

I came across Shortest Path option but it only gives solutions for points to layer or vice versa. Is there any way to calculate the shortest path between layer to layer? This shortest path function would be super useful for me if that can provide me an option to connect two points in layers having same ID number.


1 Answer 1


If you are open to using the graphical modeler, it can be achieved using an expression.

Project layers

enter image description here

The model

enter image description here

  1. The line layer representing your network
  2. The point layer representing your destination
  3. The Shortest Path (Point to Layer) algorithm (settings below)
  4. The output shortest path
Settings for the The Shortest Path (Point to Layer) algorithm

enter image description here

  1. The expression
        layer:='start point',  -- the name of your point layer with start points
        feature_id:=1)         -- the feature id of your start point

The expression will probably need tweaking depending on your specific needs, but this should get you going in the right direction.


enter image description here

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.