Drop Down Menus for the TN NG911 Server

Dec 4, 2020 | 911, QGIS

The problem is I have too many options. Options are awesome except when you’re dealing with people inputting data and you only want them to do it one way.

QGIS has had the ability to build drop down lists for a good while and it’s a very flexible way to work. For those of you in ESRI land imagine Domains and Subtypes on Steroids. In earlier versions you had widgets and currently you have Attribute Forms.

If you have a data layer in QGIS (all my layers are coming out of PostgreSQL/PostGIS) just right click the layer and go to Properties. You’ll notice all your fields have a chance to be a “widget”.

QGIS Layer Properties

Addressing data is probably 90% picking existing attributes. You don’t want to get too fancy in making up new stuff. For instance – Street Type.

USPS Sample Street Types

I ran out of fingers and toes on counting the number of street types. For the TN guys they all get a ESRI File Based Geodatabase with this information spelled out as Domain tables. How do you do that here? QGIS gives you three ways to make this happen:

  • Unique Values sums up an existing data set and you can get a pick list of existing data. The good thing is you don’t have to do anything really to make it work and the bad is you’ll get Avenue and Avenew. Misspellings aren’t your friend.
  • Value Maps let you fill things out or import a CSV. So if you save this information in a spreadsheet you can import it in.
  • Value relations pulls from an existing table. So if you build a table with this information you can pull that in by first adding the information to your QGIS session and then pulling it into the widget.

In order to cut out down the options, I pre-built all the tables needed into the database. I add them into qgis, group them, and collapse the group because No one needs to see them. Yet. You can’t use a relation widget with the table being added to QGIS.

QGIS grouped items

Back to the Attribute Forms and this is the boring part. I want to select the type table and apply it to the type field using a Value Relation. The important part is the key and the value is the description of that attribute. Both things could be “type” but I chose to have a type and a description:

QGIS setting up Type

Go through and start setting up your Forms. What if you have a second person working on this?

Save your style to the database source:

QGIS saves a table in the public schema and everyone with the proper permissions and access is good to go. Plus you don’t have to touch everyone’s QGIS session…well much. Users still have to load the tables to get started but good clean directions should work. Of course this does make me still debate a plugin that does part of this for you.

What? Yeah – it’s that easy. Everyone working with drop down menus and making good clean data.

 

 

 

 

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