7.10.1. Layer styling and labelling

Some basic settings in the Layer Properties for styling were already discussed in this tutorial (see sections 7.3.4. and 7.3.5.). Based on this experience, we will look at some more techniques to visualise different geometry types and attribute information together:

  1. Add the vector layer commune_boundary_FR.shp to the QGIS project (see section 7.3.3.).
  2. Double-click this layer in the Map Legend to open the Layer properties.
  3. Select Style.
  4. Select Graduated instead of Single Symbol.
  5. Choose an attribute (e.g. “Shape_Area”).
  6. Choose a number of Classes (e.g. 7) and the Mode Natural Breaks (Jenks).
  7. Choose colour ramp (e.g. “BuPu”).
  8. Click Classify.
  9. Click Apply (the Layer Properties can stay open).
    As an intermediate result, all polygons (representing different municipalities) are filled with a colour from the chosen spectrum corresponding to the chosen attribute (e.g. “Shape_Area”). This is already a good start, but perhaps the map should also provide the names of the communes?
  10. Switch to the Label tab (Fig. 118).
  11. Activate the checkbox to display labels.
  12. Choose an attribute field that should be displayed (e.g. “GEMNAME”).
  13. Feel free to adjust font size and colour or the placement options below.
  14. Click OK.
  15. Activate and select the layer bees_colony_locations_buffer.shp created in section 7.6.1.
  16. Place it at least one level higher than commune_boundary_FR.shp.
  17. Open again the Layer Properties.
  18. Select the Style tab.
  19. Click the button Change.
  20. Choose Outline: Simple line as Symbol layer type.
  21. Select a dark colour (e.g. black), a Pen width of about 0.25 and Dot Line as Pen style. Confirm with OK.
  22. Set the transparency to about 30%.
  23. Close the Layer Properties of bees_colony_locations_buffer.shp.
  24. Move the layer bees_colony_locations.shp on top of the Map Legend and open its Layer Properties.
  25. Not only do colours and attributes matter for the visualisation of spatial data, but also size. To demonstrate this, select the size 5, click Advanced > Size scale field and choose an attribute field of your choice (e.g. “sum”).
  26. Adjust the Size to reach a good result on the Map View. The honey bee colonies close to the city of Fribourg have now the smallest symbols, the ones closer to arable land and forests are bigger. 
  27. Switch to tab Diagrams (Fig. 119).
  28. Activate the checkbox Display diagrams and choose Pie chart as Diagram type.
  29. Set the Size to about 8 mm, the Placement AroundPoint with a Distance of 6.
  30. Now add some content for the pie charts: Use the Button text icon32 to add the fields 211mean, 312mean, 313mean and other (see section 7.9.). The colours can be adjusted by double-clicking on the coloured bar.
  31. Make the changes permanent by clicking Apply and close the Layer Properties with OK.
  32. Save the QGIS project (and all the layer styling you have done so far) by the menu File > Save.

The result (Fig. 120) is already a good start for a first visualization of geodata and it will serve as an example for the next paragraphs describing map creation functions.

In some cases it makes sense to save the layer symbology not only within a project, but also for different layers. This can be done layer by layer at the bottom of the Layer Properties dialog (see Fig. 118) using the button Save Style. This will safeguard all styling information in a *.qml-file. You can import these styles later also into other projects and apply the styles to more layers (Layer Properties > Load Style) – so this is probably the most important time-saver for larger mapping projects within QGIS.

Fig. 118. Setting labels based on attributes.


Fig. 119.
Creating diagrams based on layer attributes.


Fig. 120. Map View after changing layer style properties and labelling options.