QGIS By Example
上QQ阅读APP看书,第一时间看更新

Grouping and reordering layers

By default, layers are loaded in alphabetical order (reversely if you add them from the browser panel). Each new layer is laid on top of the previous layer and covers it. By default, all layers are turned on, styled with simple uniform symbols, and randomly assigned colors. The order of layers can be changed by simply dragging and dropping them up and down the legend. Also, it is strongly advisable to order and arrange layers in some logical groups, as it simplifies the navigation and understanding of data.

To manage and rearrange layers and maintain their visibility, use the Layer toolbar in the Layers panel, which is shown in the following screenshot and contains the buttons described afterwards (in the order of appearance from left to right):

  • Add Group: This creates an empty layers group.
  • Manage Layer Visibility: This allows us to quickly show and hide layers and also customize their visibility with predefined layer combinations—so-called presets.
  • Filter Legend By Map Content: If the filter is active, layer legend only shows those items that are actually visible inside the map canvas. All other symbols are hidden from the legend.
  • Expand All / Collapse All: Buttons are used to expand or collapse layers, symbology legends, and layer groups, if any.
  • Remove Layer/Group: This removes the selected legend entries.

There are two ways of creating a layer group:

  • Click on Grouping and reordering layers, the Add Group button, from the Layers toolbar. A new group will appear at the bottom of the list of layers. Type in an appropriate name and then drag and drop the layers into the group.
  • Select several layers while holding down the Ctrl key, and use the Group Selected right-click contextual shortcut to place them in a single group.

It is possible to develop a multilevel hierarchy with subgroups by selecting groups and applying Add Group to them. Any item of the layer legend, whether it's a single layer or a group, can be renamed with the Rename right-click shortcut. Renaming doesn't affect the dataset itself, but allows us to apply to it a proper and meaningful name within a project. Now try arranging the layers into several meaningful groups yourself, and name them appropriately.