6

I am trying to create a legend in QGIS 2.18.22 so that it only shows the features that are in the current map extent in the print composer. I have been selecting the 'only show items inside current atlas feature' tick box however nothing changes.

enter image description here

I still end up with a massive legend like this even though only a fraction of those features are visible.

enter image description here

I am reluctant to clip the layer to the current view extent to solve the problem that way as when I scan to another part of the map I will have to do the same thing again and I may need to make multiple maps off this layer. Alternatively I could also remove the classifications for each legend item that isn't visible under properties in the main map view however again every time I make a map in a different area I would have to repeat this.

What is the solution to this problem?

2
  • Are you in Atlas preview mode?
    – csk
    Commented Aug 29, 2018 at 3:17
  • No I wasn't the Atlas preview option is greyed out for me and so I can't select it within the menu
    – glouise
    Commented Aug 30, 2018 at 1:47

2 Answers 2

12

You can use the "Filter legend by map content" button in the print composer item properties for your legend item. The print composer legend will then only show the layers which are within your composer map view.

enter image description here

3
  • 1
    Great tip. I would highlight that it will also filter out the layer classes that don't show on the screen.
    – Techie_Gus
    Commented Aug 29, 2018 at 6:42
  • Awesome, this was what I was looking for. Thank you!
    – glouise
    Commented Aug 30, 2018 at 1:48
  • 3
    "Filter legend by map content" no longer exists on recent Qgis versions. Commented Mar 8 at 20:57
1

In QGIS version 3.34.6-Prizren there is a new checkbox below the Legend items showing: "Only show items inside linked maps".

If you tick this checkmark only legend items are shown which are visible in the map canvas.

See the following screenshot:

checkbox to filter legend items

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.