[Geoserver-users] GeoServer returns alpha channel with TRANSPARENT=false

We have a directory of JP2 imagery with 4 bands, the standard RGB plus NIR. When I create an ImageMosaic layer from that directory and do a WMS GetMap on that layer with TRANSPARENT=false and PNG format, I get a PNG image with an alpha band. From the OGC’s WMS 1.1.1 specification I would assume that I should only get the RGB bands when I specify TRANSPARENT=false.

If I define a 3-band SLD that specifies the RGB channels (bands) I want, I will get an RGB image without alpha channel when I specify TRANSPARENT=false. So one would say that I should just use that SLD as the default for the layer. However, that creates problems when I specify a second layer with just 3 bands in an appropriate GetMap request. The GetMap request has a bounding box such that the 4-band layer covers only the left half, and the 3-band layer appears in the right half. This works fine when no SLD (i.e. just the default raster SLD) is involved, and the resulting image has only 3 bands. However, when the above 3-band SLD is active for the 4-band layer, the right half of the returned image is transparent instead of showing the 3-band layer.

So I am wondering what I can do to get consistent 3-band output from GeoServer, especially when I have a mix of 3-band and 4-band imagery?

Thanks, Felix

On Thu, Sep 6, 2012 at 6:19 PM, Felix Mayer <Felix.Mayer@anonymised.com> wrote:

We have a directory of JP2 imagery with 4 bands, the standard RGB plus NIR. When I create an ImageMosaic layer from that directory and do a WMS GetMap on that layer with TRANSPARENT=false and PNG format, I get a PNG image with an alpha band. From the OGC’s WMS 1.1.1 specification I would assume that I should only get the RGB bands when I specify TRANSPARENT=false.

If I define a 3-band SLD that specifies the RGB channels (bands) I want, I will get an RGB image without alpha channel when I specify TRANSPARENT=false. So one would say that I should just use that SLD as the default for the layer. However, that creates problems when I specify a second layer with just 3 bands in an appropriate GetMap request. The GetMap request has a bounding box such that the 4-band layer covers only the left half, and the 3-band layer appears in the right half. This works fine when no SLD (i.e. just the default raster SLD) is involved, and the resulting image has only 3 bands. However, when the above 3-band SLD is active for the 4-band layer, the right half of the returned image is transparent instead of showing the 3-band layer.

So I am wondering what I can do to get consistent 3-band output from GeoServer, especially when I have a mix of 3-band and 4-band imagery?

The kind of situation you’re facing is uncommon, you might be hitting a situation where the existing code is simply not handling the
context in the right manner. Can you open a bug report and attach sample data, sld and the request that can reproduce the issue?
Wondering, does it really take JP2 imagery or can that be replicated with GeoTiff with the same band structure?

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it