Multispectral Images are black since Geoserver 2.22.4

Dear list,

we’re currently upgrading Geoserver from 2.22.2 to a current version. In our
setup we have an image pyramid data source with multispectral satellite
images (5 Band UInt16). Starting from Geoserver 2.22.4 the WMS renders only black areas for the existing image data. I couldn’t find a clue which could be the cause for that in the release notes:

Geoserver is running on a linx system with OpenJDK 11 and Tomcat 9. We’re
using following SLD for the rendering:

<?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor
xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
  <sld:NamedLayer>
    <sld:Name>RGB</sld:Name>
    <sld:UserStyle>
      <sld:Name>RGB</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:Title>rgb</sld:Title>
          <RasterSymbolizer>
            <Opacity>1.0</Opacity>
            <ChannelSelection>
              <RedChannel>
                <SourceChannelName>3</SourceChannelName>
              </RedChannel>
              <GreenChannel>
                <SourceChannelName>2</SourceChannelName>
              </GreenChannel>
              <BlueChannel>
                <SourceChannelName>1</SourceChannelName>
              </BlueChannel>
            </ChannelSelection>
          </RasterSymbolizer>
        </sld:Rule>
        <sld:VendorOption name="ruleEvaluation">first</sld:VendorOption>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </sld:NamedLayer>
</sld:StyledLayerDescriptor> 

I already tried ContrastEnhancement with StretchToMinimumMaximum for the
channels but without success. Do you have any hints what could cause the
problem and how to solve it?

Kind regards,

Dirk

I suppose the reason is caused by the mosaic configuration of the pyramid levels. When adding a single mosaic granule as GeoTiff datasource to geoserver, the image is rendered correctly with the above mentioned style. The pyramid or a single mosaic level doesn’t work.

So I guess the image mosaic configuration has to be adjustet. Here is a current config example:

#-Automagically created from GeoTools-
#Tue Apr 30 11:30:50 CEST 2019
MosaicCRS=EPSG\:25832
Levels=1280.0,1280.0
Heterogeneous=false
AbsolutePath=false
Name=8
HeterogeneousCRS=false
TypeName=8
Caching=false
ExpandToRGB=false
LocationAttribute=location
SuggestedSPI=com.sun.media.imageioimpl.plugins.tiff.TIFFImageReaderSpi
SuggestedFormat=org.geotools.gce.geotiff.GeoTiffFormat
CheckAuxiliaryMetadata=false
LevelsNum=1

Could be the SuggestedSPI or SuggestedFormat the cause? What other SPIs are available?

gdalinfo outputs:

gdalinfo image.tif
Driver: GTiff/GeoTIFF
Files: image.tif
          image.tif.aux.xml
Size is 530, 694
Coordinate System is:
PROJCRS["ETRS89 / UTM zone 32N",
    BASEGEOGCRS["ETRS89",
        ENSEMBLE["European Terrestrial Reference System 1989 ensemble",
            MEMBER["European Terrestrial Reference Frame 1989"],
            MEMBER["European Terrestrial Reference Frame 1990"],
            MEMBER["European Terrestrial Reference Frame 1991"],
            MEMBER["European Terrestrial Reference Frame 1992"],
            MEMBER["European Terrestrial Reference Frame 1993"],
            MEMBER["European Terrestrial Reference Frame 1994"],
            MEMBER["European Terrestrial Reference Frame 1996"],
            MEMBER["European Terrestrial Reference Frame 1997"],
            MEMBER["European Terrestrial Reference Frame 2000"],
            MEMBER["European Terrestrial Reference Frame 2005"],
            MEMBER["European Terrestrial Reference Frame 2014"],
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ENSEMBLEACCURACY[0.1]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4258]],
    CONVERSION["UTM zone 32N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["Engineering survey, topographic mapping."],
        AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."],
        BBOX[38.76,6,84.33,12]],
    ID["EPSG",25832]]
Data axis to CRS axis mapping: 1,2
Origin = (267450.000000000000000,6120500.000000000000000)
Pixel Size = (1280.000000000000000,-1280.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  267450.000, 6120500.000) (  5d20'51.83"E, 55d10'34.74"N)
Lower Left  (  267450.000, 5232180.000) (  5d55'46.06"E, 47d12' 6.99"N)
Upper Right (  945850.000, 6120500.000) ( 15d58'51.94"E, 55d 1'50.15"N)
Lower Right (  945850.000, 5232180.000) ( 14d52'31.22"E, 47d 5'31.85"N)
Center      (  606650.000, 5676340.000) ( 10d31'38.79"E, 51d13'42.47"N)
Band 1 Block=530x1 Type=UInt16, ColorInterp=Gray
  Min=0.000 Max=60601.000 
  Minimum=0.000, Maximum=60601.000, Mean=24762.934, StdDev=16232.093
  Metadata:
    STATISTICS_MAXIMUM=60601
    STATISTICS_MEAN=24762.934049263
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=16232.093448768
    STATISTICS_VALID_PERCENT=100
Band 2 Block=530x1 Type=UInt16, ColorInterp=Undefined
  Min=0.000 Max=61590.000 
  Minimum=0.000, Maximum=61590.000, Mean=25259.459, StdDev=16592.831
  Metadata:
    STATISTICS_MAXIMUM=61590
    STATISTICS_MEAN=25259.459080529
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=16592.83057058
    STATISTICS_VALID_PERCENT=100
Band 3 Block=530x1 Type=UInt16, ColorInterp=Undefined
  Min=0.000 Max=62404.000 
  Minimum=0.000, Maximum=62404.000, Mean=22913.701, StdDev=15386.760
  Metadata:
    STATISTICS_MAXIMUM=62404
    STATISTICS_MEAN=22913.701299549
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=15386.76021884
    STATISTICS_VALID_PERCENT=100
Band 4 Block=530x1 Type=UInt16, ColorInterp=Undefined
  Min=0.000 Max=62801.000 
  Minimum=0.000, Maximum=62801.000, Mean=28537.501, StdDev=18681.147
  Metadata:
    STATISTICS_MAXIMUM=62801
    STATISTICS_MEAN=28537.500899897
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=18681.146541271
    STATISTICS_VALID_PERCENT=100
Band 5 Block=530x1 Type=UInt16, ColorInterp=Undefined
  Min=0.000 Max=59759.000 
  Minimum=0.000, Maximum=59759.000, Mean=28868.930, StdDev=19125.165
  Metadata:
    STATISTICS_MAXIMUM=59759
    STATISTICS_MEAN=28868.930128867
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=19125.165477838
    STATISTICS_VALID_PERCENT=100

Ok, I just found the solution: When uncommenting SuggestedSPI it works. obviusly Geoserver determines automatically a better ImageReader that can handle the multispectral data correctly.

2 Likes