I’ve been working on a cartography project with a little bit of analysis thrown in for good measure. The fun thing is the project forced me down the PyQGIS route. Luckily for you this post won’t cover that. I actually wrote a script and it ran and it did something….it did something wrong but that’s a start.
Anyway – Distance. I had a problem and the problem was “How far are all the canoe launches from the final stop?”. So it’s a networking problem. I don’t care how much time it takes in the canoe – just distance.
I don’t use the network tools often. I’ve done shortest path routing from one location to the other before with mixed results a long time back. I have 9 locations to do. So digging through the tools it appears the Shortest Path Geoprocessing tool will work.
The tool is easy – pick a layer of points. Pick a destination. Pick a network layer which for me is the stream. Running the tool gives you a new layer of data showing the path from your points to the end point. In this case that was 9 lines in one layer for the 9 canoe launches. Each linestring has a cost which is distance. I did a join back to my canoe launch layer and suddenly in a few clicks I have the distance to the end.
From there to a spreadsheet and I have this nifty table showing the mileage from the Lee and Gordon Mill to Camp Jordan The Reeds Bridge Launch to Camp Jordan:
Was all this really worth a blog post? For me yes because I hadn’t done this lately and it was ridiculously easy. Plus this entire exercise has been fueling my PyQGIS itch. As I said earlier I had built some code to do the thing that this did – now I want to do a few things to automate running this on a larger more complicated pile of data. What if I wanted road distance to every fire station from every address? How would I automate that?
…and of course there is pgrouting – Which I’ve been playing with more these days. As I think about it that brings my networking tools to three things: QGIS, Pgrouting, and GRASS.
Anyway – Routing in QGIS is a thing. One more tool in the awesome tool box.