[GIS] Geotiffs on Geoserver – Alpha

geoservergeotiff-tifftransparency

I'm having a hard time dealing with geotiff images on a geoserver: I can't seem to get rid of the black 'no data' background around my geotiff image (a map area with a transparent background).

Further clarification: the geoTiff is in a geoserver layer group, and not a layer of its own, and it has the geoserver 'default' raster style on it (nothing but an opacity setting).

By default, my colour image is a black and white one; I can set the colour channels through the layer style, but that strips the alpha info (as I read elsewhere).

Setting the 'transparent colour' (to #000000) in the geoserver layer specifications doesn't seem to work, either.

I also see a place in the layer-specific page where we can set the channels/bands (there are five in mine, but the first four are rgba, verified by gdalinfo) to certain values (range, 'unit' (?)), but I can find no documentation on this.

Can anyone enlighten me?

Best Answer

GeoServer can only make use of the Alpha Channel when the GeoTiff has 4 channels (RGBA). Similarly, OutputTransparentColor only works on RGB / RGBA 8 bit images.

As your GeoTiff has 5 channels, your best bet is to add a layer mask to your GeoTiffs.

gdal_translate ... -mask the_mask.tif ...

Or add vector footprints as sidecar files (.shp or .wkt).

Note: You will also need to select the RGB channels in the Style.

Related Question