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

Alessandro Pasotti apasotti at gmail.com
Wed Apr 7 01:05:41 PDT 2021


On Wed, Apr 7, 2021 at 9:40 AM pathmapper <pathmapper at posteo.de> wrote:
>
> 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


Hi Bjoern,

I'm not aware of any option, do you think that the same solution
implemented with https://github.com/qgis/QGIS/pull/42193 would work if
extended to multiband rasters?

It would make it possible to have the "old" legend style, but I don't
understand if that is exactly what you want.

In any event, you should probably file a feature request ticket.

Kind regards.

-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it


More information about the QGIS-Developer mailing list