3

I'd like to know how to connect two points not in a linear way (shortest way), but following an existing route in QGIS. I'm using "Points to path".

For example, not in this way:

enter image description here

but in this way:

enter image description here

Any suggestions?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Mark
  • 965
  • 6
  • 12

2 Answers2

1

Easiest is to use Network tool Shortest path: Menu processing > Toolbox > Shortest path (point to point).

Use the line as network layer. For start- and end-point activate snapping and select the points by clicking on the ... icon as you can see on the screesnhot: the red line is the output.

enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
  • Is it possible to use this tool easily, when i've lots of points which i have to connect grouping by id? – Mark Aug 29 '22 at 15:07
  • Network tools look for the shortest/fastest path along a network, without respecting any id information – Babel Aug 29 '22 at 15:20
0

I propose that you split your route (blue line) using the two points, then select the resulting line segment of interest (which is labeled in your second screenshot as "Output"). To do this, use the Processing > Toolbox > Saga > Features - Lines > Split Lines at Points tool.

See also: Splitting line layer using another point layer in QGIS

Stu Smith
  • 8,252
  • 8
  • 35
  • 84
  • I think that "splitting lines" it's not the right way because, in general, i've lots of points which i have to connect grouping by id. I usually use at the moment "points to path". – Mark May 11 '22 at 08:55