7

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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
RyanKDalton
  • 23,068
  • 17
  • 110
  • 178

2 Answers2

3

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

Mohannad Adham
  • 429
  • 2
  • 6
  • 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 05:12
  • You are welcome Ryan! Glad to hear that it worked for you. – Mohannad Adham Sep 27 '18 at 06: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 '21 at 11:46
-1

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

César Arquero Cabral
  • 3,439
  • 1
  • 16
  • 53
  • 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