I am trying to get transparent parts of an 3-channel raster with NoData pixel values in GeoServer.
As suggested in here, I created alpha channel with pixels that have No Data Value (0) as a mask using GDAL
`gdalwarp -srcnodata 0 -dstalpha input.tif output.tif`
As a result I got 4-channel (RGB+alpha) where the pixels that previously were 0 now have 0 values in all four channels and those, that were > 0, in alpha channel have value 255. Also No Data Value is set to 0.
When I upload raster to GeoServer (v2.5.2) using QGIS plugin OpenGeo Explorer, instead of transparent pixels I get black pixels. What could be the problem? I have also tried without setting No Data Value without results.
—————EDIT—————-
Geoserver version: 2.5.2
Raster style:
<?xml version="1.0" encoding="UTF-8"?> <sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0"> <sld:NamedLayer> <sld:Name>RGB raster</sld:Name> <sld:UserStyle> <sld:Name>RGB raster</sld:Name> <sld:FeatureTypeStyle> <sld:Name>name</sld:Name> <sld:Rule> <sld:Name>Single symbol</sld:Name> <sld:RasterSymbolizer> <sld:ChannelSelection> <sld:RedChannel> <sld:SourceChannelName>1</sld:SourceChannelName> </sld:RedChannel> <sld:GreenChannel> <sld:SourceChannelName>2</sld:SourceChannelName> </sld:GreenChannel> <sld:BlueChannel> <sld:SourceChannelName>3</sld:SourceChannelName> </sld:BlueChannel> </sld:ChannelSelection> </sld:RasterSymbolizer> </sld:Rule> </sld:FeatureTypeStyle> </sld:UserStyle>
Here is the request:
request=GetMap&layers=jaun:ORO2&styles=&bbox=515813.19564,305943.471,516026.19564,306105.471&width=512&height=389&srs=EPSG:3059&format=application/openlayers&transparent=true
Best Answer
Ciao, the style you are using is stripping out the alpha band. Use the standard/default raster.sld style.
Simone.