# Shortest path using line layer QGIS

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"

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

• What software and tools can you access? What have you tried? If you get stuck with that then ask about that specifically in this question which you can revise by using the edit button beneath it. – Taras Jan 9 at 9:32

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.
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.
Then run Shortest Path (Point to Point) on the splittet layer again.