Setting up Drop-down list in QGIS Forms for editing similar to Domain Attributes in ArcMap.

This tutorial will offer a graphical illustration of how to enable drop-down lists in QGIS Action Forms for attribute entry during GIS data editing like what the Ersi Domain attributes and Sub-types offer. The capability is way felixible and productive in QGIS than ArcMap. The tutorial is simple and recommended for all levels of QGIS users.

More often than not while editing attributes for feature objects in QGIS like any other software you’d want to have drop down list for some fields. Something like a combo box of value where you don’t have to type in values but select.  While this ability may seem a convenience stand, it is actually a standard practice in software and highly recommended for 2 reasons;

  • To ensure standard values for category attributes; essentially helping you avoid HOSPITAL, Hosptal, hospital, HS, Hosp, issues with your data.
  • and of course it make your data entry life easier and  fun

It is not just a cool trick but a data collection software best practice in designing a data entry forms to have the two last columns a drop down list or choice list.

In GIS where data entry is key, this feature is not a luxury but a basic necessity. It has almost come to be know as Domain and Subtypes borrowing from the Esri Geodatabase approach to this capability.

Now, how do you achieve this desirable ability in the most popular open source GIS, QGIS?

The tutorial will assume you are well acquainted with adding your data into QGIS as layers from the various sources as anybody with desire for this feature probably is.

It also assumes you are on QGIS 2.x

Step 1.

Determine the Fields from your layer that you want to add choice list to and create layer with all the possible values. You can do this in a CSV file. If you are on Postgis or Spatialite DB, this is totally possible, create a table with your choice list attribute values.

These are my tables; a parcels table (the main layer) and the tenure_types and land_uses tables. We will be editing creating parcels in QGIS and using the values in the other two tables as sources of attributes.

This are the contents of the two attribute values tables


Step 2. Add your data to QGIS Canvas. I recommend the QGIS DB Manager to manage your database– it will allow you add non-geometry table to QGIS directly. Check it out. Make your QGIS life fantastic. Read more on it here and here also.

You should have something like this before proceeding;

Step 3. The real thing now

Go to the Layer Properties of your main layer, in my case the Parcels Layer by Right Clicking on it and then Click on Properties. In the Layer Properties Dialog window Click on Fields Tab.

Dear QGIS user let me introduce you to the gist of attribute data editing in QGIS. Edit Widget, the wizard.

The Edit Widget is a magic performer when it comes to applying rules and behaviors to fields in your layer so as to make attribute editing smooth and appealing. Want a date popup, you got it, UUID generator, Check Boxes, Photo field name it and ability to use drop down list option.

As I have mentioned, a wizard does have many tricks up their sleeves, and so does the Edit Widget. Thanks to the extensible architecture of QGIS through plugins the amazing open source community is able to add such amazing features to its trunk.

By default, Edit Widget offers three options to create drop down lists, Relation Reference, Value Map, and Value Relation.This tutorial will cover Value Relation. Relation Reference is good for something slightly different and I will cover this on later tutorial. Value Map delivers the same functionality as Value Relation with slight technical differences if context discussed in this tutorial as well.

Let’s get right back into the tutorial.

RELATED:  9 Interesting topics in the Geospatial Industry for 2017

Step 3a.

In the Field Tab window we will go to QGIS Edit Widget.

  • Click on the button under Edit Widget in front of the column you want to create option lists  for. In this case land_use.
  • This will take you to Edit Widget Properties Dialog.

I will show you how to create the drop-down list using Value Map and Value Relation separately. I take time to explain so that you get value from this tutorial, it’s not just another blank “THE HOW TO’s of the INTERNET”.

Value Map

  • Click on Value Map Tab, Click on Load from Layer to load values from a layer in the Layer Panel this will get you a window similar to this one.
Load values from layer Dialog


1-> the value layer name (for example land_uses, tenure_types or anything else) Note: this is the intended source of the values to add to the drop down list.

2 -> Code field (example; the field code which will contain the short codes for your values )

3 -> The Visible values field. This is the human readable field values

To see all the possible value click on the View All button. Check the Insert NULL value on top radio button for Nullable fields and Click OK. Your values are loaded as below

Click OK again to save your drop down list and close the Edit Widgets Properties dialog.

When you create a new feature in QGIS on the layer now, in my case a parcel, the two screenshots show what you’ll get when you edit the attributes from the QGIS Form popup or attribute table respectively.







The same procedure applies for Loading values from CSV file.

Value Relation


1-> set a default value, usually a recurrent value or most prominent value or a safe fallback value if field is not Nullable

2-> Select the layer that has the values you’d like to provide in the drop-down list

3-> Code field name

4 -> The human readable value field

5-> Set a filter expression for the values. The filter will let the editor load only values that satisfy the feature being edited. For example filter Sub Counties depending on the County. This filter expression can me made a fancy as Pythonically possible.

I will cover filters in the next tutorial on this topic.

From the process, there are key differences you may have noticed that will definitely influence your choice.

1-> While Value Map load the values into QGIS memory which makes the values static, Value Relation is a live retrieval of the values from the layer source. If you’re living dangerously with a database which keeps changing Value relation is your guy. Obviously this makes Value Relation the best choice.

This is the same reason, Value Relation is more superior to Domain Attributes in Geodatabases. While you have to input the Domain values in the Geodatabse Properties every time you come across a new value, using Value Relation will make the new values available in your drop down list in QGIS as soon and the Database table containing them is updated from whatever part of the world.

Look out for Creating Filters for  the Drop Down Lists. Read here for Dynamic Filtering of your Option Lists



Steve Ochieng
About Steve Ochieng 18 Articles
Geospatial Specialist | Avid Reader and Vivid Writer here | Geospatial Tech Advocacy and Evangelism | GeoProgrammer and Follower of @geohipster