I have a road network linking multiple (ca 1830) agricultural production regions to several ports (ca 12). (lines in the pic below are roads, small black dots centroids for producing regions and larger dots ports)

I would like to calculate the road path of shortest distance from each production region to each port. For each road connection I would then like to calculate a cumulative "cost" (really risk in this case) for travelling that road based on spatial distribution of flood risk (I have the risk data in both raster and vector format), values ranging from 0 to 1 (low to high risk: white to dark blue in the image below).

enter image description here

I have tried calculating nearest way to port using QNEAT3, but it only provides me with distance, and not the pathway with the physical road travelled (and so I cant use it for calculating the cumulative risk value). and even if it did provide me with the actual physical shortest roads, I don't seem to find a great way to calculate cumulative values along multiple lines.

Does anyone know how to solve this?

  • 1
    If you're cool with using the python editor, you should look into the networkX package. It will return a list of nodes comprising each shortest-distance path (and other cool stuff). You could also weight each link by the risk and compute shortest paths that minimize risk. I would be surprised if QNEAT3 doesn't somehow return the pathways, but I know nothing about it. – Jon Feb 27 at 17:17
  • Hi Jon! Thanks for the responce. Unfortunately i'm not python litterate (yet). QNEAT calculate shortest routes with pathways only betwwen two single points, which in this case would leave me doing 1830 separate analysis unfortunalely... – Frida_L Feb 27 at 17:23
  • I assume you have a network of roads, and each port is a node in the network and each production region is also a node in the network. You will have to compute the shortest path from each production node to the nearest port, if I understand correctly. networkX has tools that are great for this: networkx.github.io/documentation/stable/reference/algorithms/… That's really all I can offer since I don't know QNEAT, but if I were you I'd scour the QNEAT documentation. – Jon Feb 27 at 17:28
  • Have you tried the shortest path algorithm as explained in the Network Analysis Lesson of the QGIS Training Manual? It has batch processing. – csk Feb 27 at 17:29
  • Could incorporating the flooding-risk values in the cost attribute of the street network be a viable solution? By mixing distance cost with flood-risk cost you would be able to retrieve all cumulative costs for least-risky/shortest paths using the m:n OD-Matrix tool provided by QNEAT3. But this would also take into account the flood risk values at the routing level (eg. it would be a mix of least flood risk and shortest path). I did not include an m:n shortest path algorithm in QNEAT3, and QGIS does not support that kind of routing out of the box (only 1:n relations are possible). – root676 Feb 28 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.