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?


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

| improve this answer | |
  • 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. – RyanKDalton Sep 20 '18 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. – RyanKDalton Sep 27 '18 at 5:12
  • You are welcome Ryan! Glad to hear that it worked for you. – Mohannad Adham Sep 27 '18 at 6:17

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

| improve this answer | |
  • 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. – RyanKDalton Sep 26 '18 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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