Trying to use a Jiffle transformation in a style along with a Channel Selection rule will end up with the following error message:
Error rendering coverage on the fast path java.lang.RuntimeException: Failed to evaluate the process function, error is: java.lang.NullPointerException Failed to evaluate the process function, error is: java.lang.NullPointerException java.lang.NullPointerException
Removing the Channel Selection from the rule will render correctly.
Example SLD :
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>Redacted name</Name>
<UserStyle>
<Title>Redacted title</Title>
<FeatureTypeStyle>
<Transformation>
<ogc:Function name="ras:Jiffle">
<ogc:Function name="parameter">
<ogc:Literal>coverage</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>script</ogc:Literal>
<ogc:Literal>
if( src[6] > 2 ) dest = src[0];
</ogc:Literal>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<Name>color scale</Name>
<RasterSymbolizer>
<ChannelSelection>
<GrayChannel>
<SourceChannelName>1</SourceChannelName>
</GrayChannel>
</ChannelSelection>
<Opacity>1.0</Opacity>
<ColorMap type="ramp">
<ColorMapEntry color="#ffffff" quantity="270.14" opacity="0"/>
<ColorMapEntry color="#ffd4ff" quantity="273.2884" />
<ColorMapEntry color="#3e0000" quantity="308.0096" />
<ColorMapEntry color="#000000" quantity="308.15" />
</ColorMap>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
|