SLDService can generate invalid SLD for rasters with a single value

Description

Classifying a raster that has a uniform value (e.g., all pixels at zero) causes the generation of a SLD with a single color map entry, e.g.:

 

<?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>farm:raster</sld:Name>
<sld:UserStyle>
<sld:Name>Default Styler</sld:Name>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:ColorMap type="intervals">
<sld:ColorMapEntry color="#000000" opacity="0" quantity="10.0"/>
</sld:ColorMap>
<sld:ContrastEnhancement/>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>

However, that's not a valid SLD, unless the mode is "values" (interpolation and interval based ones need at least two entries)

Environment

None

Assignee

Andrea Aime

Reporter

Andrea Aime

Triage

None

Fix versions

None

Affects versions

None

Priority

Medium
Configure