2

I have a landcover raster layer. I use the styles of a QML-file. Is there an option to reduce my style classes shown in the legend to only the relevant classes shown in the map?

The QML has 44 classes, but on the map, there are only 26 classes shown. In ArcGIS, there was an option to automatically reduce the legend to the relevant classes. Is that also possible in QGIS?

enter image description here

  • It's not the solution you want, but it is easy to select multiple classes in the layer's symbology using the windows selection methods (shift or alt key + select) and delete them from that symbology, and then they won't show in the inserted legend. – johns Sep 16 at 18:20
  • Yes, that is what I normally do with other datasets. But in this case I have to verify for each class whether they are actually shown in the map. This is ok, if I do it once. But this approach doesn't work when I use the Atlas function and each region has a different combination of landcover classes... – Enzo Baldini Sep 17 at 9:51
  • Have you tried ticking the checkbox to "Only show items inside linked map" ("Nur Objekte innerhalb der verknüpften Karte anzeigen" in your attached image) ? – Ben W Sep 17 at 10:10
  • I think the" only items inside option" works with vector layers but that does suggest another workaround - convert the raster to polygons and then use that in the maps. – johns Sep 17 at 12:43
  • @BenW: Yes I tried that, the result is the same. – Enzo Baldini Sep 17 at 14:05
3

I just need to push the button "classify" in the style settings in the layer settings, after I imported the QML-file. Then it reduces the 44 clc classes to the actual existing 25 clc classes in the region.

In the screenshot, you can see that clc classes not existing in the region (like the ocean, lagunes, etc.) are not shown in the legend anymore.

enter image description here

enter image description here

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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