[QGIS-Developer] Disable descriptive legends for raster layers (for use with QGIS Server)

pathmapper pathmapper at posteo.de
Wed Apr 7 00:40:09 PDT 2021


Hi,

https://github.com/qgis/QGIS/pull/40620 introduced more descriptive 
legends for raster layers.

While this might be useful when working with QGIS Desktop, I'm looking 
for a way to disable them for using a project with QGIS Server.

By default, QGIS server uses for the WMS legend image what is shown for 
the layer as legend in the layer widget.

Before this change, for a multiband color raster layer this was only the 
layer title.

With the more descriptive legend also the band information is added to 
the WMS legend image, which is in my use case not needed and could 
confuse the user (the WMS is used within an application which shows the 
legend image).

https://github.com/qgis/QGIS/pull/42193 introduced an option for using 
the "old" legend style, but not for multiband color raster layers.

The only solution which I can think of to have only the raster layer 
title as legend image is to create a single image with the layer name, 
upload it to a server and add it's path as LegendUrl to layer server 
settings.

This option is quite a lot of work if you are having a project with 
multiple raster layers and also you have to update these images every 
time when the layer titles are changing.

Is there currently another option to
a) disable the more descriptive legends for raster layers (to have the 
behavior before https://github.com/qgis/QGIS/pull/40620) ?
b) use only the layer title of a multiband color raster layer for the 
WMS legend image with QGIS Server?

Thanks,
Bjoern


More information about the QGIS-Developer mailing list