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!

mgri
  • 16,159
  • 6
  • 47
  • 80
Thomas
  • 573
  • 1
  • 4
  • 13

2 Answers2

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.

Ian Turton
  • 81,417
  • 6
  • 84
  • 185
  • 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 07 '11 at 07:37
  • 1
    OK I made it work with the following: ` 1 ` – Thomas Jun 07 '11 at 08:24
  • note: for multiband images this method does not work. See post http://gis.stackexchange.com/questions/41472/setting-transparency-in-an-sld-file-for-a-4-channel-geotiff – xandriksson Jun 26 '13 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