1

I am trying to perform a linear interpolation on a coverage layer (Source data is in EHdr Coverage format, file extension: .flt). Ultimately, I want to use the interpolated layer as input to a WPS process.

From what I could gather, the first step is using the "Interpolate" function in an sld. Using the sld posted at the end, I get a "Rendering process failed" exception when I try to preview the layer as "tiff". Removing the <Transformation> block, the layer displays normally.

Can anyone point out what I am doing wrong? If there is an alternative way to perform linear interpolation before storing the layer in geoserver, that is also an option (as long as it can be automated).

EDIT: As requested, additional information from the log. Can't say I see something wrong.:

[....]Caused by: java.lang.NullPointerException at org.geotools.filter.function.InterpolateFunction.evaluate(InterpolateFunction.java:245) at org.geotools.filter.function.InterpolateFunction.evaluate(InterpolateFunction.java:215) at org.geotools.renderer.lite.RenderingTransformationHelper.applyRenderingTransformation(RenderingTransformationHelper.java:193) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:2005) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:814) at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(RenderedImageMapOutputFormat.java:489)"

Looking at the source code of InterpolateFunction (lines 241-249):

/*
         * TODO: is this the correct way to handle the rasterdata option ?
         */
        String lookupString = lookup.evaluate(object, String.class);
        if (lookupString.equalsIgnoreCase(RASTER_DATA)) {
            lookupValue = ((Number) object).doubleValue();
        } else {
            lookupValue = Double.valueOf(lookupString);
        }

The SLD file:

<?xml version="1.0" encoding="utf-8"?>
<StyledLayerDescriptor version="1.0.0" 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"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>testRaster</Name>
    <UserStyle>
      <Name>testRaster</Name>
      <FeatureTypeStyle>
        <Transformation>
            <ogc:Function name="Interpolate">
                 <!-- Property to transform -->
                 <ogc:PropertyName>Rasterdata</ogc:PropertyName>

                 <!-- Mapping curve definition pairs (input, output) -->

                 <ogc:Literal>0.23</ogc:Literal>
                 <ogc:Literal>0.0</ogc:Literal>

                 <ogc:Literal>0.24</ogc:Literal>
                 <ogc:Literal>0.06</ogc:Literal>

                <ogc:Literal>0.26</ogc:Literal>
                <ogc:Literal>0.15</ogc:Literal>

                <ogc:Literal>0.27</ogc:Literal>
                <ogc:Literal>0.27</ogc:Literal>

                <ogc:Literal>0.29</ogc:Literal>
                <ogc:Literal>0.51</ogc:Literal>

                <ogc:Literal>0.30</ogc:Literal>
                <ogc:Literal>0.58</ogc:Literal>

                <ogc:Literal>0.32</ogc:Literal>
                <ogc:Literal>0.60</ogc:Literal>

                <ogc:Literal>0.34</ogc:Literal>
                <ogc:Literal>0.61</ogc:Literal>

                <ogc:Literal>0.41</ogc:Literal>
                <ogc:Literal>0.63</ogc:Literal>

                <ogc:Literal>0.49</ogc:Literal>
                <ogc:Literal>0.65</ogc:Literal>

                <ogc:Literal>0.52</ogc:Literal>
                <ogc:Literal>0.67</ogc:Literal>

                <ogc:Literal>0.55</ogc:Literal>
                <ogc:Literal>0.68</ogc:Literal>

                <ogc:Literal>0.58</ogc:Literal>
                <ogc:Literal>0.70</ogc:Literal>

                <ogc:Literal>0.61</ogc:Literal>
                <ogc:Literal>0.72</ogc:Literal>

                <ogc:Literal>0.62</ogc:Literal>
                <ogc:Literal>0.74</ogc:Literal>

                <ogc:Literal>0.66</ogc:Literal>
                <ogc:Literal>0.78</ogc:Literal>

                <ogc:Literal>0.67</ogc:Literal>
                <ogc:Literal>0.81</ogc:Literal>

                <ogc:Literal>0.69</ogc:Literal>
                <ogc:Literal>0.86</ogc:Literal>

                <ogc:Literal>0.72</ogc:Literal>
                <ogc:Literal>0.94</ogc:Literal>

                <ogc:Literal>0.73</ogc:Literal>
                <ogc:Literal>0.97</ogc:Literal>

                <ogc:Literal>0.75</ogc:Literal>
                <ogc:Literal>0.99</ogc:Literal>

                <ogc:Literal>0.76</ogc:Literal>
                <ogc:Literal>1.0</ogc:Literal>

                 <!-- Interpolation method -->
                 <ogc:Literal>numeric</ogc:Literal>

                 <!-- Interpolation mode - defaults to linear -->
                 <ogc:Literal>linear</ogc:Literal>
               </ogc:Function>

        </Transformation>

        <Rule>
          <RasterSymbolizer>

            <Opacity>1.0</Opacity>
            <ColorMap>
                <ColorMapEntry color="#000000" quantity="0" label="NO DATA" opacity="0.0" />
                <ColorMapEntry color="#FF0000" quantity="0.05" label="0.05"  />
                <ColorMapEntry color="#FF2000" quantity="0.1" label="0.1" />
                <ColorMapEntry color="#FF4000" quantity="0.25" label="0.2" />
                <ColorMapEntry color="#005000" quantity="0.3" label="0.3" />
                <ColorMapEntry color="#006000" quantity="0.4" label="0.4" />
                <ColorMapEntry color="#007000" quantity="0.5" label="0.5" />
                <ColorMapEntry color="#008000" quantity="0.6" label="0.6" />
                <ColorMapEntry color="#009000" quantity="0.7" label="0.7" />
                <ColorMapEntry color="#00A000" quantity="0.8" label="0.8" />
                <ColorMapEntry color="#00C000" quantity="0.9" label="0.9" />
                <ColorMapEntry color="#00E000" quantity="1.0" label="1.0" />
                <ColorMapEntry color="#00FFF00" quantity="1.1" label="1.1" />
                <ColorMapEntry color="#00FF00" quantity="1.2" label="1.2" />
                <ColorMapEntry color="#D0FF00" quantity="1.3" label="1.3" />
                <ColorMapEntry color="#B0FF00" quantity="1.4" label="1.4" />
                <ColorMapEntry color="#A0FF00" quantity="1.5" label="1.5" />
                <ColorMapEntry color="#80FF00" quantity="1.6" label="1.6" />
            </ColorMap>
          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
  • turn up logging and then look in the log file – Ian Turton Dec 12 '14 at 14:02
  • I already have. Can't figure out anything wrong. See edit in my post. – pkExec Dec 12 '14 at 14:13

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.