7.6.4. Dissolve

In section 7.4.2., a definition query was set from the polygon layer representing different municipalities within the canton of Fribourg (Fig. 85). To aggregate all features that contain the same attribute “KANTONSNR” by producing a vector layer of all districts, the Dissolve function is a good option (see section 6.5.7. for further explanation about the dissolve tool):

  1. Open the Query Builder for the polygon layer you want to use by right-clicking.
  2. Make sure that no restriction is made within the SQL “where clause” (If you use the layer commune_boundary_FR.shp, delete the entry "KANTONSNR" = 10, if this still exists).
  3. Confirm with OK.
  4. Go to Vector.
  5. Select Geoprocessing Tools.
  6. Choose Dissolve.
  7. Locate the layer commune_boundary_FR.shp as Input vector layer.
  8. Leave the checkbox Use only selected features blank (with this the operation could be performed on a selection of features only, but in our case no selection has to be applied).
  9. Select an attribute (e.g. “BEZIRKSNR”) as Dissolve field.
  10. Choose a path and name for the destination file to be created (Fig. 98). 
  11. Finish by clicking OK.
    Now the whole canton of Fribourg is selectable at once (representing only one line within the Attribute table), and the “island polygons” in the north-western part demonstrate what is meant by a “multipart polygon”. What happened to the attributes? – Of course some of the attributes are no longer thematically correct: the dissolve function allocates the attributes from the first line of each value that was aggregated. The display of the new layer can be improved:
  12. Open the Layer Properties.
  13. Select Style.
  14. Set a categorized symbol style with different fill colours for all 5 districts (by using the column “BEZIRKSNR”).
  15. Choose a colour ramp.
  16. Click Classify.
  17. Apply the changes.
  18. Close the Layer Properties dialog by clicking OK.
  19. The result will look similar to Fig. 99.

Fig. 98. Dissolving polygons by the attribute “BEZIRKSNR”: The new layer will contain aggregated polygons based on this attribute.


Fig. 99. After applying the Dissolve tool, the polygon layer is divided into 5 different districts. The thin black lines on top represent the former state (51 different municipalities. The yellow circles were created using a radial buffer of 2000 m around of all the honey bee colony locations. Reproduced with permission of Swisstopo (BA13016).