12

This is a bit of a beginner question I guess but I just can't find a clear answer anywhere...

I have a projected satellite image (warped via gdal) and would like to set the no data pixels to a transparent value so that when the wms layer of my (image) coverage is added on my map only the projected image is displayed (and not the balck area around).

Is it in the sld for my layer? is it in the wms parameters? do I need a rgba image format? etc... Any pointers would be highly appreciated!

2 Answers 2

4

You need to add a ColorMap entry for the no data value in the SLD file that is set to be transparent. See https://docs.geoserver.org/latest/en/user/styling/css/cookbook/raster.html for more details.

3
  • 2
    Thanks for the answer. Can you develop a bit? All my attempts to use ColorMap fail. This is typically what I am doing: create a raster style with the ColorMap with <ColorMap> <ColorMapEntry color="#000000" quantity="1" opacity="0"/> </ColorMap> And then I apply it to the raster layer.
    – Thomas
    Jun 7, 2011 at 7:37
  • 1
    OK I made it work with the following: <ChannelSelection> <RedChannel> <SourceChannelName>1</SourceChannelName> </RedChannel> </ChannelSelection> <ColorMap> <ColorMapEntry color="#000000" quantity="1" opacity="0"/> <ColorMapEntry color="#000000" quantity="2" opacity="1"/> <ColorMapEntry color="#FFFFFF" quantity="256" opacity="1"/>
    – Thomas
    Jun 7, 2011 at 8:24
  • note: for multiband images this method does not work. See post gis.stackexchange.com/questions/41472/… Jun 26, 2013 at 11:31
0

This work form me. (Geoserver 2.8.2, GeoTiff, GrayBand). http://geoserver.geo-solutions.it/edu/en/pretty_maps/styling_raster.html

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.