Thursday, 17 October 2019

geoserver - How to change the WMS Background Color in OpenLayers?


I am using geoserver to serve up an image pyramid basemap. I want to have all areas outside of the data extent be black (instead of white).


I have the map displayed inside of a div tag and changing the css on that tag or the container (another div) it resides in has no effect. I have checked both the geoserver and openlayers documentation, but have not seen any way to change the background color.


Any suggestions on where to continue searching? Do I need to generate a black tiles and serve them?




Answer



You can set the background color in the WMS request, using the BGCOLOR param, with a hex value. Example: &BGCOLOR=0x000000


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...