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:
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 :
Top is "high" and bottom is "low".
Can you help me? Any clues or suggestions will appreciate. Thank you.
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.