2

I have a WMS service created using GeoServer, and I need to get a legend with a transparent background. I used the 'GetLegendGraphic' request, but when there are multiple legend items, gaps appear between them. There are no gaps if I set parameter transparent to false. Is it possible to remove these gaps? I need to add this legend to my web application.

enter image description here

https://www.sopsr.sk/geoserver/sopsr/ows?layer=IG_vPROTECTEDSITES_VCHU&service=WMS&request=GetLegendGraphic&version=1.3.0&format=image%2Fpng&width=20&height=20&transparent=false

enter image description here

https://www.sopsr.sk/geoserver/sopsr/ows?layer=IG_vPROTECTEDSITES_VCHU&service=WMS&request=GetLegendGraphic&version=1.3.0&format=image%2Fpng&width=20&height=20&transparent=true

1 Answer 1

0

That looks like a bug, feel free to put a report in.

As a work around may be you could just set the background colour to match your apps background:

&LEGEND_OPTIONS=bgColor:0xff0000 

https://www.sopsr.sk/geoserver/sopsr/ows?layer=IG_vPROTECTEDSITES_VCHU&service=WMS&request=GetLegendGraphic&version=1.3.0&format=image%2Fpng&width=20&height=20&&LEGEND_OPTIONS=bgColor:0xff0000

enter image description here

2
  • Thank you for your reply. bgColor is not supported by WMS services created in ArcGIS Server. In our application, we are using WMS services from various external sources.
    – Peter
    Commented Oct 15 at 13:36
  • that might be the problem with transparency too
    – Ian Turton
    Commented Oct 15 at 14:58

Your Answer

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

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