qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.26k stars 2.95k forks source link

Add an option to hide raster band in legend Map Composer #51877

Open arno974 opened 1 year ago

arno974 commented 1 year ago

Feature description

When adding a legend in the Map Composer, QGIS automatically add the raster bands of the rasters in the project. While this could be interesting for some raster, it is also unnecessary for some others. For example, it is not necessary to show the raster bands for a simple georeferenced aerial picture.

In the draw raster symbol section in the map composer it is only possible to customize the band symbol. Would it be possible to add a checkbox in the legend properties that would allow turning on/off the raster band in the map composer ?

image

Additional context

No response

nicogodet commented 1 year ago

You can just delete it image

It will not work if you use Automatic update...

arno974 commented 1 year ago

@nicogodet that could be of course an option, but for that I must disable the "automatically update" parameter. Something I avoid as if your turn it on then again you lose all your modifications.

Moreover, I give a lot of QGIS Training and for new users this is counter intuitive. They do not understand why these bands appear and how to easily make them disappear. Again, for new users, having to play with the "automatically update" parameter should be (IMHO) to avoid.

A simple approach with a checkbox that allows to hide/show the raster symbol could enhance the user experience.

roya0045 commented 1 year ago

Seems related to https://github.com/qgis/QGIS-Enhancement-Proposals/issues/253

I have a fix to not display non-vector layer that are out of the map view, but that won't fix this issue.

hudjinn commented 1 year ago

I would like to kindly ask someone to help fix this issue of not being able to hide the raster band in the layers panel. Some automations I developed to read these subtitles have since broken and I can't change them to not display this information.

hydroEng commented 2 months ago

Has anyone figured out how to remove this using pyqgis? Creating an ATLAS workbook and having to remove each band label manually is extremely tedious.

It seems QgsLayoutItemLegend does not store entries and their labels. Will poke around more but if anyone knows where legend item labels can be overwritten, that would be great...