Unintended Joy

Jul 2, 2024 | 911, QGIS

I was originally going to call this unintended consequences but – there was a small amount of joy at the end.

In Tennessee you have 6 layers that are required by the NG 911 group. So you end up with a lot of information depending on the county being poured into the address layer. You may have fire hydrants, fire stations, EMS locations, etc all appearing in the address layer.

You could export out the fire hydrants into a separate layer. You could – but then you’ve broken your data to a degree because then you always have to refresh it wither weekly or monthly just to keep that shapefile updated. Yes I said Shapefile.

We did this for a bit:

Virtual layers in QGIS work great. I always dig back through my blogging and it’s been a while since I’ve mentioned Virtual Layers. You create those in much the same manner you would a file (Layers-> Crete Layers) except you are prompted to add or import a layer. From there you can execute some SQL and have a virtual layer than updates as you update the data. You don’t update the virtual layer itself – just the underlying data. Bonus – it works with Mergin Maps.

Of course I worry about losing the QGZ file. It doesn’t happen much but upon occasion it does happen. So after some talk we offloaded the problem to Postgresql/Postgis in the form of a view. Views can be slow – but we aren’t going to have too much with this small county so:

CREATE VIEW hcgis.fire_hydrants_view
 AS
 SELECT
    a.id,
    a.oirid,
    a.geom,
    a.address,
    a.strucdesc
   FROM tn911.address_points b,
    tn911.address_points a
  WHERE strucdesc = 'Fire Hydrant';

Selecting data isn’t hard. You could very easily pull this out however you want it. Symbolizing data isn’t hard – there are enough tricks in QGIS we can go this route. I like making the server work a little. So we pulled Fire Hydrants into a view. We also pulled a few more things out to save some heartburn for crazy last minute requests.

What about a materialized view? I could have but this isn’t a lot of data. Bonus it does pull into Mergin Maps. Granted with a view vs a viirtual layer you could edit the fire hydrant layer – but – for me the pros outweigh the cons.

Anyway – the small opensource 911 project kicks along unintentionally bringing some fun to a 911 in TN near you.

You may also like

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...

QGIS US – September 22nd 2026 EDT

QGIS US – September 22nd 2026 EDT

It's been a while since I've done a QGIS US meeting. Part of it was burnout and part I've been busy with work and life. So we're talking projections tomorrow. Proj is a bigger project than just QGIS - but it's nice to know how that project is moving along. Meeting...

QGIS Offline Help

QGIS Offline Help

Through a long series of events I found myself teaching QGIS in a classroom again. It's been a while. I used to just "hold" classes and sometime during the pandemic I jsut stopped. Occasionally I'll get a call for 3 or 4 people that want training but generally I've...