Bug report #17475

QGIS 2.99 Shortest Path not showing shortest route

Added by Joshua Geoghegan over 2 years ago. Updated over 2 years ago.

Status:Closed
Priority:Normal
Assignee:Borys Jurgiel
Category:Processing/QGIS
Affected QGIS version:master Regression?:No
Operating System:Windows 10 Enterprize Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:25372

Description

Hi there,

I have been using the Shortest path plugin to get the shortest route between a set of points, along a road network to a primary destination.
Sometimes this works fine but in some areas the routes are indirect. In some cases some start points aren't picked up at all. See attached jpg where both routes are not correct and some points are ignored.
I have followed the suggested steps of cleaning up the road network with
- simplifying
- run the 'snap geometries to layer' algorithm over it, and snap it back to itself (will move nearby vertices so that they exactly coincide)
- run the 'split with lines' algorithm over it, using the snapped layer as both the source and split layer (will create additional nodes where lines overlap, which the network analysis tools require)
- run 'multiparts to singleparts' on the result.
I've played around with the topology tolerance with little or no luck.
Is this a bug or something that I have missed?

Regards,

Josh

shortest_routes.jpg (118 KB) Joshua Geoghegan, 2017-11-16 06:40 AM

Data.zip (1.02 MB) Joshua Geoghegan, 2017-11-19 10:29 PM

shortest_routes.png - missing vertices (347 KB) Borys Jurgiel, 2017-11-25 01:21 PM

History

#1 Updated by Harrissou Santanna over 2 years ago

Are you using master? Afaict, shortest Path (roadgraph?) is no longer a plugin; it's a processing alg now. (just to set the right tags to the issue report)

#2 Updated by Borys Jurgiel over 2 years ago

  • Category changed from Plugin Manager to Processing/QGIS

Right, it's not a plugin anymore.

Your problem looks like some line ends within the unregarded shortcuts still don't overlap. You can examine their coordinates (zooming in may be enough to see the gap) or put starting and ending point close to the suspected vertex in order to see if the algorithm still avoids it.

If you won't find gaps in those places, could you please attach a sample dataset with the affected area?

#3 Updated by Joshua Geoghegan over 2 years ago

Hi there. I couldn't find any gaps in the sections of interest. See files attached.
The network is QGIS_Roads, startpoint is Meshblock_Centrepoint, end point is Primary_Destinations.

Thanks,

Josh

#4 Updated by Borys Jurgiel over 2 years ago

Hi,

Your data misses some vertices, so the lines are not connected (please note two lines are only connected if they both have a vertex in the same place). I marked such missing connections for two destinations.

Btw. the dataset you attached contains more missing routes than the screenshot - e.g. in the roundabout's neighbourhood.

#5 Updated by Joshua Geoghegan over 2 years ago

Thanks for that.

Does QGIS have a plugin to create vertices where lines intersect?
Snapping doesn't seem to add these missing vertices.
I've also tried extending lines slightly and split lines but the results are the same.

#6 Updated by Borys Jurgiel over 2 years ago

You have to intersect the lines in order to split, snapping won't do it.
Please consult the qgis-user mailing list or any other users' forum.

#7 Updated by Giovanni Manghi over 2 years ago

Joshua Geoghegan wrote:

Thanks for that.

Does QGIS have a plugin to create vertices where lines intersect?
Snapping doesn't seem to add these missing vertices.
I've also tried extending lines slightly and split lines but the results are the same.

use the processing toolbox, specifically the v.clean tool from GRASS, "break" option.

Also available in: Atom PDF