Is there a method in QGIS to select all connected lines that are between a start and end feature (point or selected lines)?

I imagine a workflow going something like this:

  1. Choose the starting line feature
  2. Choose the ending line feature
  3. Run a process that will select all features (between the start and end) that are connected.

The end result would look something highlighted yellow lines in the picture below, assuming I had pre-selected lines at the beginning and end of the now highlighted arcs.

enter image description here

This is an alternative method: How do I select the longest connected lines from PostGIS ST_ApproximateMedialAxis?


2 Answers 2


The best solution that I can think of is to calculate the shortest path between two points using the Road Graph plugin.

You can find a full example of the usage of the plugin here 7.3. Lesson: Network Analysis - QGIS

Start and end points

The result of the Road Graph plugin

  • I thought I had tried the road graph tool before, but I'll have to try again. Thank you for including the link to the tutorial. Sep 20, 2018 at 21:51
  • The RoadGrpah tool worked great! Clearly I did something wrong the first time I tried it. Thank you for the nudge I needed to try it again. Sep 27, 2018 at 5:12
  • You are welcome Ryan! Glad to hear that it worked for you. Sep 27, 2018 at 6:17
  • I do not understand why it has to be complicated to select all lines in between selected points or lines. In JOSM, it is as simple as Shift + click (Ctrl+click selects individual lines).
    – JAT86
    Jul 17, 2021 at 11:46

It depends on how your data where produced. If they follow an order you could try this:

  1. Select first and last segments with ctrl + selection tool.
  2. Execute a selection expresion like this:

enter image description here

  • Interesting method, I'll have to look into this further. It was created with ST_ApproximateMedialAxis from PostGIS, so I'm not sure how the attributes are coded. Sep 26, 2018 at 21:54

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.