How far is it?

Apr 20, 2021 | QGIS

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.

You may also like

TNGIC 2024

TNGIC 2024

So - if you're coming to the 2024 TNGIC (TN Geographic Information Council) meeting (April 9-11 2024) to talk about how no one understands what you do......I'm doing a workshop. What workshop? It's a new workshop. QGIS and LIDAR data. As to what I do with the class...

iNaturalist and QGIS

I am probably the worst for being able to properly name "things". There are big trees and little trees. There are the annoying bugs and the not so annoying bugs. There are ducks, birds, bigger birds, and the birds that hang out at my bird feeder. As much time as I...

Mergin Maps and DB Sync

Mergin Maps and DB Sync

I don't know if I would label this exercise as fun but I've learned alot. I don't do a ton of data collection these days. At one time a few years ago I was out in the field with Fulcrum, a laptop, and sketchy internet for days at a time. These days I'm hardly ever...