Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print legend does not work with composite WMS layers #2092

Open
steff-o opened this issue Dec 4, 2024 · 2 comments · May be fixed by #2116
Open

Print legend does not work with composite WMS layers #2092

steff-o opened this issue Dec 4, 2024 · 2 comments · May be fixed by #2116
Labels

Comments

@steff-o
Copy link
Contributor

steff-o commented Dec 4, 2024

Describe the bug
The legend in the print view does not correctly handle WMS composite layers. If a WMS layer is a composite layer (server side, not Origo group layer) only the rules from the first layer is displayed but the images for those rules are missing.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a composite layer consisting of at least two layers with thematic styling on Geoserver
  2. Configure origo to display the layer having hasThemeLegend (but not thematicStyling)
  3. Go to print preview
  4. Only the legend rules from the first layer is displayed but the legend images are the "image not found place holders".

Expected behavior
I would expect all rules from all layers to be displayed.

Screenshots
If applicable, add screenshots to help explain your problem.
image
Image 1: The composite legend in map view with rules from both layers in composite layer

image
Image 2: The legend i print only displaying rules from first layer and browser's placeholder images

Mapserver

  • Geoserver 2.25.3

Additional context
The steps to reproduce above uses CSS styles, i.e. rules without names, which would explain why there are no images. If I change to SLD using named rules it instead squeezes in the entire group image on each rule. That seems to be some quirky bug in Geoserver that produces an image of the composite layer when the rule name matches a rule name in an underlying layer's style.

From what I have seen in the code, the problem is that print-legend only loops the rules in json.Legend[0] and does not use the correct layer name. It sends the composite layer name and the rule name for the underlying layer. It would probably have to loop the json.Legend[] array and make calls for all underlaying layers and rules, or just get the composite layer legend graphic like the map legend does. If it had been configured with thematicStyling getting the entire composite layer graphic may not be ideal if it supposed to only display visible rules.

@JohanPihelAtWork
Copy link
Contributor

The issue is not possible to reproduce using QGIS Server, is it a Origo-issue or a GeoServer issue?

bild
bild

@steff-o
Copy link
Contributor Author

steff-o commented Dec 19, 2024

@JohanPihelAtWork is that really a composite layer or group layer or whatever it is called in Qgis server? I.e. a layer that is composed of two or more already existing layers? (Not that i don't trust you, just want to make sure you didn't miss the subtle "composite" part in the description). Your screenshots have checkboxes before every type, which indicates you don't have the same configuration as described in the issue. You've probably used thematicStyling, which I didn't, but thematicStyling didn't work with GeoServer either, but produced another error.

Anyhow, can you please post the json returned from print preview's request as I don't have access to a Qgis server. Or, if you can point me to a publicly accessible composite layer from a QGis server.

It is very likely that it differs between GeoServer and Qgis, as this functionality is probably a bit beyond standard, and it is a known issue that Geoserver don't name the rules when using CSS-styling, but that is easy to overcome by using SLD-styling.

Luckily for us, @Grammostola has successfully contributed a PR to Geoserver that will make it possible to name CSS-styling rules, which should be available in Geoserver 2.26.0 if I understood it correctly.

@steff-o steff-o linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants