1

I published a layer using one band Geotiff file in Geoserver which I set its SLD style.

The SLD which can render the layer style normally is like this:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0" xmlns:sld="http://www.opengis.net/sld">
  <UserLayer>
    <sld:LayerFeatureConstraints>
      <sld:FeatureTypeConstraint/>
    </sld:LayerFeatureConstraints>
    <sld:UserStyle>
      <sld:Name>one_band</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:RasterSymbolizer>
            <sld:ChannelSelection>
              <sld:GrayChannel>
                <sld:SourceChannelName>1</sld:SourceChannelName>
              </sld:GrayChannel>
            </sld:ChannelSelection>
            <sld:ColorMap type="ramp">
              <sld:ColorMapEntry quantity="777.09796142578125" label="low" color="#d7191c"/>
              <sld:ColorMapEntry quantity="1605.9965057373047" label="" color="#fdae61"/>
              <sld:ColorMapEntry quantity="2434.8950500488281" label="" color="#ffffbf"/>
              <sld:ColorMapEntry quantity="3263.7935943603516" label="" color="#abdda4"/>
              <sld:ColorMapEntry quantity="4092.692138671875" label="high" color="#2b83ba"/>
            </sld:ColorMap>
          </sld:RasterSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </UserLayer>
</StyledLayerDescriptor>

But when I reverse the label "high" and "low" ,it cant render the layer normally:

<sld:ColorMapEntry quantity="4092.692138671875" label="high" color="#2b83ba"/>
<sld:ColorMapEntry quantity="3263.7935943603516" label="" color="#abdda4"/>
<sld:ColorMapEntry quantity="2434.8950500488281" label="" color="#ffffbf"/>
<sld:ColorMapEntry quantity="1605.9965057373047" label="" color="#fdae61"/>              
<sld:ColorMapEntry quantity="777.09796142578125" label="low" color="#d7191c"/>

Geoserver log show :

java.lang.IllegalArgumentException: Provided ranges are overlapping:-Infinity : 4092.692138671875 / 777.0979614257812 : 4092.692138671875
at it.geosolutions.jaiext.piecewise.PiecewiseUtilities.domainElementsOverlap(PiecewiseUtilities.java:62)
at it.geosolutions.jaiext.piecewise.DefaultDomain1D.init(DefaultDomain1D.java:181)
at it.geosolutions.jaiext.piecewise.DefaultDomain1D.<init>(DefaultDomain1D.java:132)
at it.geosolutions.jaiext.piecewise.DefaultPiecewiseTransform1D.<init>(DefaultPiecewiseTransform1D.java:42)
at it.geosolutions.jaiext.classifier.LinearColorMap.initColorModel(LinearColorMap.java:398)
at it.geosolutions.jaiext.classifier.LinearColorMap.hasGaps(LinearColorMap.java:519)
at org.geotools.image.ImageWorker.classify(ImageWorker.java:5018)
at org.geotools.renderer.lite.gridcoverage2d.ColorMapNode.execute(ColorMapNode.java:288)
at org.geotools.renderer.lite.gridcoverage2d.ColorMapNode.execute(ColorMapNode.java:65)
at org.geotools.renderer.lite.gridcoverage2d.StyleVisitorCoverageProcessingNodeAdapter$1.execute(StyleVisitorCoverageProcessingNodeAdapter.java:94)
at org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.checkExecuted(BaseCoverageProcessingNode.java:229)
at org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.getOutput(BaseCoverageProcessingNode.java:329)
at org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.getOutput(BaseCoverageProcessingNode.java:51)
at org.geotools.renderer.lite.gridcoverage2d.StyleVisitorCoverageProcessingNodeAdapter.getOutput(StyleVisitorCoverageProcessingNodeAdapter.java:130)
at org.geotools.renderer.lite.gridcoverage2d.ContrastEnhancementNode.execute(ContrastEnhancementNode.java:232)

Caused by: org.geoserver.platform.ServiceException: org.geotools.coverage.processing.CoverageProcessingException: org.geotools.coverage.processing.CoverageProcessingException: org.geotools.coverage.processing.CoverageProcessingException: java.lang.IllegalArgumentException: Provided ranges are overlapping:-Infinity : 4092.692138671875 / 777.0979614257812 : 4092.692138671875

And Geoserver Layer Preview shows error: enter image description here

Why?

Url below is my Geotiff file's location: http://47.94.232.132:801/one_band.tif

My Geoserver version is 2.22.0. And I tested in Geoserver 2.18.3 version the problem is the same.

Actually I want to show the legendGraphic like this :

enter image description here

Top is "high" and bottom is "low".

Can you help me? Any clues or suggestions will appreciate. Thank you.

George
  • 27
  • 3
  • Why do you want to order the quantity from high to low? – Mustafa Özçetin May 31 '23 at 07:18
  • I want to show the legendGraphic top "high" and bottom "low".I have added the picture into my post above. – George May 31 '23 at 07:38
  • I see. Yes, this is quite a reasonable demand but I think there is a problem with the reverse quantity ordering like yours. All SLD `ColorMap` examples I saw so far use the ascending order with the quantity. Have a look at [this Github page](https://github.com/ISRICWorldSoil/SoilGrids250m/issues/11). – Mustafa Özçetin May 31 '23 at 07:43
  • 1
    It says *JAI render has problems and requires that the SLD is by order of quantities.* (JAI stands for Java Advanced Imaging). This page is not for GeoServer but it is relevant with SLD too and may be useful for you. – Mustafa Özçetin May 31 '23 at 07:45
  • Thank you.Your answer is useful.I got it. – George May 31 '23 at 08:22

1 Answers1

0

As far as I can tell there is nothing in the SLD Standard to require the colorMap entries to be in ascending order all the examples do that. I'd raise a bug on GeoTools about it but with out funding or code I doubt that anyone will fix it for you.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47
  • OK,Thank you for your reply Ian.It is not a urgent problem.I will finish my demand using Andrea's method temporarily. – George May 31 '23 at 09:39