Styling classes

“When data are in discrete classes, you can assign visual styles for each class ”

Some data naturally lend themselves to being symbolised according to classes. A good example is a land cover dataset where each landcover area represents a specific landcover class. These classes can each be assigned a distinct symbol, making it easy to visualise the data. In QGIS we do this using the Categorized symbol renderer.

You try:

Goal: Explore the use of categorised renderers in QGIS.

  • Load the Countries and Time Zones layers from the exercise data.
  • Make sure the countries layer is above the time zones layer
  • Apply a uniform style to the countries layer and make sure it is above the time zones layer.
  • Style the time zones layer according to the specification table below

Check your results
Compare your map to the image at the start of this worksheet - were you able to achieve similar results?

Name Expectation

Symbol renderer

Categorized

Colum

Zone

Symbol

Edit the base symbol to have a solid fill with 50% transparency

Colour ramp

Random

More about

The categorized renderer is useful when you have data that is classified by discrete values. The legend for a categorized layer will show a unique colour or symbol for each class. When you have a large number of classes, a categorized symbology may be challenging for the user of your map to interpret since it can be difficult to distinguish visually between the different classes.

The initial colours assigned to your categories will be defined by the colour ramp you choose. Depending on your choice of ramp, you may find that two or more classes have been assigned the same colour. Each class in the categorized renderer's legend can be edited as a single symbol renderer. This means you can, for example, use colour, line hatchings, SVG markers and so on to differentiate each class clearly.

Before using a categorized renderer, you should review the attribute table of your vector layer and evaluate whether you have a suitable attribute for categorizing. Some good examples of attributes you could use are land cover classes, building types, road types.

Categorized renderers can be used with any vector layer geometry type - points, lines and polygons. The symbology options available will be adjusted accordingly.

Check your knowledge:

  1. The maximum number of classes supported by QGIS in a categorized layer:

    1. 10
    2. 100
    3. No Limit
  2. Can you use a categorized fill on a raster layer:

    1. Yes
    2. No
  3. Once your categories have been defined, they cannot be changed:

    1. True
    2. False