0

I have a 4 channel GeoTIFF in float format. It is a False Colour Composite for a remotely sensed image. It is being clearly displayed in QGIS3, but the display is not there while I used Layer Preview.

Software used: Platform independent binary (GeoServer version 2.15.1) OS: Win 64 Bit: 64

I used QGIS 3 to export the display parameters to an SLD file, and the contents of the file are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
  <UserLayer>
    <sld:LayerFeatureConstraints>
      <sld:FeatureTypeConstraint/>
    </sld:LayerFeatureConstraints>
    <sld:UserStyle>
      <sld:Name>20131213_fcc</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:RasterSymbolizer>
            <sld:ChannelSelection>
              <sld:RedChannel>
                <sld:SourceChannelName>4</sld:SourceChannelName>
                <sld:ContrastEnhancement>
                  <sld:Normalize>
                    <sld:VendorOption name="algorithm">StretchToMinimumMaximum</sld:VendorOption>
                    <sld:VendorOption name="minValue">0.134255</sld:VendorOption>
                    <sld:VendorOption name="maxValue">0.308156</sld:VendorOption>
                  </sld:Normalize>
                </sld:ContrastEnhancement>
              </sld:RedChannel>
              <sld:GreenChannel>
                <sld:SourceChannelName>3</sld:SourceChannelName>
                <sld:ContrastEnhancement>
                  <sld:Normalize>
                    <sld:VendorOption name="algorithm">StretchToMinimumMaximum</sld:VendorOption>
                    <sld:VendorOption name="minValue">0.0270592</sld:VendorOption>
                    <sld:VendorOption name="maxValue">0.101896</sld:VendorOption>
                  </sld:Normalize>
                </sld:ContrastEnhancement>
              </sld:GreenChannel>
              <sld:BlueChannel>
                <sld:SourceChannelName>2</sld:SourceChannelName>
                <sld:ContrastEnhancement>
                  <sld:Normalize>
                    <sld:VendorOption name="algorithm">StretchToMinimumMaximum</sld:VendorOption>
                    <sld:VendorOption name="minValue">0.025894</sld:VendorOption>
                    <sld:VendorOption name="maxValue">0.0675469</sld:VendorOption>
                  </sld:Normalize>
                </sld:ContrastEnhancement>
              </sld:BlueChannel>
            </sld:ChannelSelection>
          </sld:RasterSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </UserLayer>
</StyledLayerDescriptor>

When I attempt to validate this file, through the GeoServer interface, it gives me the following message:

ine 20: cvc-complex-type.2.1: Element 'sld:Normalize' must have no character or element information item [children], because the type's content type is empty.
line 30: cvc-complex-type.2.1: Element 'sld:Normalize' must have no character or element information item [children], because the type's content type is empty.
line 40: cvc-complex-type.2.1: Element 'sld:Normalize' must have no character or element information item [children], because the type's content type is empty.

I am running the GeoServer instance through a command line, and there the following information is being displayed:

Request: getMap
        Angle = 0.0
        BaseUrl = http://localhost:8081/geoserver/
        Bbox = SRSEnvelope[18.45703125 : 25.048828125, 72.235107421875 : 88.341064453125]
        BgColor = java.awt.Color[r=255,g=255,b=255]
        Buffer = 0
        CQLFilter = null
        Crs = GEOGCS["WGS 84",
  DATUM["World Geodetic System 1984",
    SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],
    AUTHORITY["EPSG","6326"]],
  PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
  UNIT["degree", 0.017453292519943295],
  AXIS["Geodetic latitude", NORTH],
  AXIS["Geodetic longitude", EAST],
  AUTHORITY["EPSG","4326"]]
        Elevation = []
        Env = {}
        Exceptions = application/vnd.ogc.se_inimage
        FeatureId = null
        FeatureVersion = null
        Filter = null
        Filters = null
        Format = image/png
        FormatOptions = {FONTANTIALIASING=true, LAYOUT=style-editor-legend}
        Get = true
        Height = 300
        Interpolations = []
        Layers = [org.geoserver.wms.MapLayerInfo@51e5cdac]
        MaxFeatures = null
        Palette = null
        RawKvp = {FORMAT=image/png, CRS=EPSG:4326, RANDOM=-425785009, STYLES=RasterFCC, WIDTH=733, HEIGHT=300, LEGEND_OPTIONS=forceLabels:on;fontAntiAliasing:true, LAYERS=heatislands:20131213_fcc, EXCEPTIONS=application/vnd.ogc.se_inimage, REQUEST=GetMap, FORMAT_OPTIONS=layout:style-editor-legend;fontAntiAliasing:true, BBOX=18.45703125,72.235107421875,25.048828125,88.341064453125, VERSION=1.3.0, SERVICE=WMS, TRANSPARENT=true}
        RemoteOwsType = null
        RemoteOwsURL = null
        Request = GetMap
        RequestCharset = UTF-8
        ScaleMethod = null
        Sld = null
        SldBody = null
        SldVersion = null
        SortBy = null
        SortByArrays = null
        SRS = urn:ogc:def:crs:EPSG:4326
        StartIndex = null
        StyleBody = null
        StyleFormat = sld
        Styles = [StyleImpl[ name=RasterFCC]]
        StyleUrl = null
        StyleVersion = null
        Tiled = false
        TilesOrigin = null
        Time = []
        Transparent = true
        ValidateSchema = false
        Version = 1.3.0
        ViewParams = null
        Width = 733

So I am looking for a solution, as none of the methods proposed on the Internet is really helping.

Edit: As per the response to the one of the comments, I am pasting the gdalinfo for the file:

Driver: GTiff/GeoTIFF
Files: PANSTACK.tif
       PANSTACK.tif.aux.xml
Size is 3490, 3695
Coordinate System is:
PROJCS["WGS 84 / UTM zone 43N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",75],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32643"]]
Origin = (517695.000000000000000,2230065.000000000000000)
Pixel Size = (15.000000000000000,-15.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  517695.000, 2230065.000) ( 75d10' 9.62"E, 20d10' 4.27"N)
Lower Left  (  517695.000, 2174640.000) ( 75d10' 7.71"E, 19d40' 1.17"N)
Upper Right (  570045.000, 2230065.000) ( 75d40'13.11"E, 20d 9'59.96"N)
Lower Right (  570045.000, 2174640.000) ( 75d40' 5.53"E, 19d39'56.98"N)
Center      (  543870.000, 2202352.500) ( 75d25' 8.99"E, 19d55' 1.24"N)
Band 1 Block=3490x1 Type=Float32, ColorInterp=Gray
  Min=0.009 Max=0.174 
  Minimum=0.009, Maximum=0.174, Mean=0.032, StdDev=0.010
  NoData Value=0
  Metadata:
    STATISTICS_APPROXIMATE=YES
    STATISTICS_MAXIMUM=0.17436291277409
    STATISTICS_MEAN=0.031811518750804
    STATISTICS_MINIMUM=0.009465697221458
    STATISTICS_STDDEV=0.0095483798792937
    STATISTICS_VALID_PERCENT=55.1
Band 2 Block=3490x1 Type=Float32, ColorInterp=Undefined
  Min=0.011 Max=0.237 
  Minimum=0.011, Maximum=0.237, Mean=0.043, StdDev=0.013
  NoData Value=0
  Metadata:
    STATISTICS_APPROXIMATE=YES
    STATISTICS_MAXIMUM=0.23692084848881
    STATISTICS_MEAN=0.043476237747542
    STATISTICS_MINIMUM=0.01090501435101
    STATISTICS_STDDEV=0.012537424490973
    STATISTICS_VALID_PERCENT=55.06
Band 3 Block=3490x1 Type=Float32, ColorInterp=Undefined
  Min=0.014 Max=0.299 
  Minimum=0.014, Maximum=0.299, Mean=0.059, StdDev=0.023
  NoData Value=0
  Metadata:
    STATISTICS_APPROXIMATE=YES
    STATISTICS_MAXIMUM=0.29942682385445
    STATISTICS_MEAN=0.059237122956141
    STATISTICS_MINIMUM=0.013894255273044
    STATISTICS_STDDEV=0.023491112587145
    STATISTICS_VALID_PERCENT=55.06
Band 4 Block=3490x1 Type=Float32, ColorInterp=Undefined
  Min=0.031 Max=0.590 
  Minimum=0.031, Maximum=0.590, Mean=0.223, StdDev=0.045
  NoData Value=0
  Metadata:
    STATISTICS_APPROXIMATE=YES
    STATISTICS_MAXIMUM=0.59000414609909
    STATISTICS_MEAN=0.22257502396889
    STATISTICS_MINIMUM=0.030675740912557
    STATISTICS_STDDEV=0.044938696791732
    STATISTICS_VALID_PERCENT=55.06
  • Does it work with the default raster sld? – Ian Turton Jun 22 at 18:05
  • No, I tried it a lot of times. – Indian Jun 24 at 14:28
  • then your raster is probably broken or not where you think it is, please add the gdalinfo for it to your question – Ian Turton Jun 24 at 15:07
  • Pasted the GDAL information. I am very organised file handling wise, so there is not question about me missing any of the information / location. – Indian Jun 26 at 13:49
1

It seems to be known that GeoServer does not validate SLD like you have but it should still work

From: Ian Turton - 2017-08-01 10:57:00

https://sourceforge.net/p/geoserver/mailman/geoserver-users/thread/CAJaHrDzHyPrvv_OVRoGuesib5%3DPx5%3DCkyfm1p0gMhroi%2BpZ8Yw%40mail.gmail.com/

It is right but it is technically invalid SLD so the validator rejects it. It will work fine as it is.

I tried your SLD with some random 4 band GeoTIFF on my machine with GeoServer 2.14.2 and it did work despite that I had to edit minValue and maxValue of one band probably because my test image did not have data within the original range.

The SLD validator was throwing the same errors for me as well.

0

I have tried the following steps and the raster gets rendered. I am posting this, so that people could explore as to why this happens

  1. Opened the raster in QGIS 3.6
  2. Exported the raster in rendered mode, rather than raw data mode
  3. Used this raster in Geoserver and the map is successfully rendered.

Interestingly, while using this rendered version of the raster, the properties as seen in the Geoserver configuration are the same as the raw data parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.