TransWikia.com

Shortest path using line layer QGIS

Geographic Information Systems Asked by Tobbe on June 27, 2021

I have a layer consisting of aprox. 20k lines

What I want to do:

In QGIS I want to be able to enter a start point and a end point. Preferably with street addresses and in second hand with coordinates. I then want a calculation of what lines that would represent the shortest path between these points. And then be able to export the result. The start and endpoint are usually not along the lines.

I’ve tried "Shortest Path" but i get an error

There is no route from start point to end point

As shown in the picture the red line is the line layer. The arrows represent the start and stop point. When the "processing" is done i would like to have the line in the red circle as "selected".

enter image description here

It is not roads and roads has nothing to do with the question.

One Answer

Shortest Path (Point to Point) can do what you need. First, all your lines have to be in the same layer. Merge them if needed.

Then, to avoid your error, your lines need to be connected via nodes.

To connect intersecting lines via nodes, use Split with lines tool and choose your line layer as input as well as split layer. This will cut lines where they intersect.

enter image description here

Then run Shortest Path (Point to Point) on the splittet layer again.

In case they have no connection at all, there is of course no shortest - or at all, any path.

Answered by MrXsquared on June 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP