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.59k stars 3.01k forks source link

QGIS Server: fixed width of 200 px of cascaded WMS layer legends #57422

Closed danceb closed 1 month ago

danceb commented 5 months ago

What is the bug or the crash?

Hi there,

I came across https://github.com/qgis/QGIS/issues/42063 and yippie, getting the legend of cascaded WMS layer is working again after a long time!

While testing this, I have discovered, that the resulting legend image of the requested layer has always a max width value of 200 px. This does not make sense in my opinion, as it leads to labels which are to small to read, especially if the legend graphic of the original layer is much wider than 200 px.

So where is this value come from and why is it there?

My suggestion would be to just cascade the width and height of the original layer legend here instead of setting a fixed value.

Thanks for any reply!

Steps to reproduce the issue

  1. Setting up a QGIS project to publish via QGIS Server
  2. include a WMS layer from an external OGC service
  3. publish the project via QGIS Server
  4. Request the legend image of the external wms layer with a GetLegendGraphic-Request

Versions

3.34.6

Supported QGIS version

New profile

Additional context

No response

elpaso commented 1 month ago

Can you please provide a test project with the not-working cascading WMS? This would spare us the time to search and find a suitable example.

danceb commented 1 month ago

Hey, @elpaso, thanks a lot for reaching out to this issue!

Here is an example project, with two cascaded WMS services: example_map.zip

This is a GetLegend request to the service from the project with a cascaded wms layer: https://kartenportal.jena.de/api/v1/legend/stadtplan?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetLegendGraphic&LAYER=Flaechen&FORMAT=image/png&STYLE=default&SLD_VERSION=1.1.0

And in comparison this requests shows the legend of the original non cascaded layer: https://kartenportal.jena.de/api/v1/legend/stadtplan_flae?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetLegendGraphic&LAYER=stadtplan_flae&FORMAT=image/png&STYLE=default&SLD_VERSION=1.1.0