Rule-based symbology

Rule-Based Symbology & Labeling in QGIS

When dealing with symbology in QGIS, there are over eight(8) options one can use. The symbology utilized is dependent on the data available; category, quantity, ratio, interval, and many more. Depending on the data available you have the option to use single symbols, categorized or even graduated symbols. Rule-based symbology offers flexibility and more control over the creation of your symbols.

As shown below, different symbologies will produce desired results in various modes and visualizations.

Graduated symbology
Graduated Symbology (Showing Population)
Rule-Based Symbology
Rule-Based Symbology

To implement complex rules in rule-based symbology, a good understanding of selecting features using an expression is required. Depending on the rules, the expressions can be simple or complex. In the expression string builder in QGIS, there are many functions and options that one can use to achieve the required expressions.

Expressions for rule-based-symbology
A screenshot of the Expression String Builder in QGIS

In an ideal situation, depending on the attributes in a layer, one can always construct an expression to filter the features on the layer. As mentioned above, an expression can be simple or complex. These expressions depend on the desired outputs. For example; One can write an expression that uses one attribute/field in the attribute table or you can have multiple attributes used. QGIS offers a long list of functions to use in your expressions.

In the example above, shown in the screenshots, the use of the logical operator “OR” denotes that this expression uses one attribute for selection. In the tutorial below, you will have a chance to use other logical operators and also customize your expressions to suit the data in your project.

In most cases, Rule-Based symbology is useful when you require full control of your symbology options. Remember, there’s no limit on the number of rules that can go into a layer.

To do this practically, I’ve recorded the video below.

Let me know if you have questions on this topic.

Wanjohi Kibui

A GIS user with interests in web and desktop systems development, FOSS advocate, trainer and mentor. Lives in Nairobi but finds adventure in travelling. The "Life in GIS" phrase is as a result of the many told and untold stories in the Geospatial realm.

More Reading

Post navigation