0

I have a raster displaying slopes whose pixel values go from 0 to 85. Like most values are between the range (0 - 30) when publishing in GeoServer I want to apply to it the following sld file to make the raster more readable.

<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld">
    <sld:UserLayer>
        <sld:LayerFeatureConstraints>
            <sld:FeatureTypeConstraint/>
        </sld:LayerFeatureConstraints>
        <sld:UserStyle>
            <sld:Name>SlopeMaps</sld:Name>
            <sld:Title/>
            <sld:FeatureTypeStyle>
                <sld:Name/>
                <sld:Rule>
                    <sld:RasterSymbolizer>
                        <sld:Geometry>
                            <ogc:PropertyName>grid</ogc:PropertyName>
                        </sld:Geometry>
                        <sld:Opacity>1.0</sld:Opacity>
                        <sld:ColorMap>
                            <sld:ColorMapEntry color="#000000" opacity="1.0" quantity="0"/>
                            <sld:ColorMapEntry color="#FFFFFF" opacity="1.0" quantity="35"/>
                            <sld:ColorMapEntry color="#000000" opacity="0.0" quantity="255"/>
                        </sld:ColorMap>
                    </sld:RasterSymbolizer>
                </sld:Rule>
            </sld:FeatureTypeStyle>
        </sld:UserStyle>
    </sld:UserLayer>
</sld:StyledLayerDescriptor>

The problem is that when applying this style to that specific raster a rgb(255, 128, 128) reddish colour appears not only in the layer bounding box but in the all visible area. See image below.

layer when applying the sld file

Here is the image with the default raster style of GeoServer with the value of the pixels.

Raster Default geoServer's Raster Style

When applying the style to rasters with no data values the reddish colour does not appears.

I also have tried deleting the last sld:ColorMapEntry in case is not working properly but the reddish colour keeps appearing.

Your Answer

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

Browse other questions tagged or ask your own question.