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

FOSS4GNA 2026 – Post1 – Toasters

FOSS4GNA 2026 – Post1 – Toasters

I tell a lot of jokes that are only funny to me. That may be the worse type of joke - but I laugh and on some days that is the important thing. So my joke at FOSS4GNA 2026 was "I didn't watch 4 seasons of Battlestar Galactica for us to end up here...again". If you've...

FOSS4GNA 2026

Greetings from the Atlanta Airport at 7:10 AM. I am again flying during a time change - my body says it's 8:10 but overall - this is easier than flying in the spring when the time changes. I've already gotten lost twice and asked for directions once. So this will be...

The Aunt II: Adding Cemeteries

The Aunt II: Adding Cemeteries

In a previous post I talked about my aunt that died and we couldn't find the cemetery. Found it! Welcome to the Bethel Cemetery. I will tip my hat to the inherent creepiness of the whole thing. Who is rising second? So I want to add cemeteries to OSM. In my first...