0

I have a group layer in geoserver with all layers having one style each.

However, for the legend I want to refer to an "external" SLD (basically a simplified "dummy legend"). The SLD is in the same workspace as the group layer and I guess you can specify the SLD you want to get by GetLegendGraphic Parameters? Here specifically, I'm thinking of the SLD parameter.

The solution (I think) is something like this:

https://wms.myserver.com/geoserver/my_workspace/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=30&HEIGHT=30&LAYER=my_group_layer&SLD=**???**

In the SLD documentation it says thatt you can refer to an external SLD by a URL. How do i know what URL to use as a parameter?

1 Answer 1

1

If your style is already published by GeoServer then you can just use the style parameter in the GetLegend request:

http://localhost:8080/geoserver/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=topp%3Astates&style=pophatch

If you need to send specific SLD then the process is the same as sending it for a layer as discussed in this question and the manual

1
  • Makes perfect sense, problem solved! Thanks! Feb 16, 2022 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.