3

I have a project with many layers. Some layers are objects of interest while other layers are custom layers. Simplified example:

  • Streets (polygon)
  • Buildings (polygon)
  • Street names (point)

I created a print layout and now I want to add a dynamic legend. The legend should update automatically if I change the color of a layer, but I do not want to see some layers in the legends. I want only the polygons of the streets and houses, but not the street names point in the legend.

If I remove the check in "update automatically" in order to remove or add items the legend loses the update option. So if I change the color of the roads the legend shows the old color.

How can I update the legend with layer style changes, without losing my changes to which layers are displayed?

10
  • When you uncheck "update automatically", just click on refresh view button, it should be updated unless you are locking the layer that you want to update its color. In this case you need to unlock the layer and click the refresh view button.
    – ahmadhanb
    Commented Feb 12, 2019 at 13:59
  • No, maybe I did not explain well. if I remove the layer of street names from the legend (I have to remove the check to "update automatically) so if I change a color of a layer and I want to update by clicking on update it also re-inserts the layer I had removed. I use QGIS 2.18.16
    – titino
    Commented Feb 12, 2019 at 14:08
  • If you want to keep street names and remove the point style, you can set the point style to No Symbols and just keep the labels. Can this option solve your problem?
    – ahmadhanb
    Commented Feb 12, 2019 at 14:22
  • no, because the layer name appear in the legend
    – titino
    Commented Feb 12, 2019 at 14:25
  • But you can delete the layer name from the table of contents as a workaround. Go to layer properties -> General -> Layer name -> delete. Or simply select the layer, click on F2 delete the layer name.
    – ahmadhanb
    Commented Feb 12, 2019 at 14:29

3 Answers 3

4

Uncheck 'auto-update' as indicated in the comments to remove the unwanted layer(s) from the legend. After you make any changes to styles, press "Refresh view" (blue 'recycle' button) in the layout screen and your changes will now appear in both the map and the legend without adding the unwanted layer back into the legend.

1

QGIS seems to force anything with a symbol into the legend via auto-update. Unless it is mandatory that you keep the actual symbol, such as a point or arrow, you can maintain the label of the street names in your map and hide this layers from the legend auto-update by turning off symbols in the Symbology tab of Street Name Layer Properties.

Simply double click the Street Name layer and scroll down to the Symbology tab. At the very top, select the dropdown box that says Single Symbol and select No Symbols. These symbols will now be invisible from the map but your labels will still exist. This essentially hides this layer from the legend as there are no symbols in that layer for the legend to illustrate.

If you must have a symbol visible, then you really can't hide this layer from the legend auto-update feature and you will have to edit your legend manually in the print composer to hide it from view.

1

You could use "Filter legend by map content" to get only those layers which are set as visible. See https://gis.stackexchange.com/a/294288

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.