4

We have data being represented by the colormap copied below. I need to use env variables to change the hard coded color steps into whatever's input to the url parameters. I know you can use<ogc:Function name="env"> to pull variable values out of the url but I'm not really sure how to use that to replace the hard coded values. The colors aren't changing, just the quantity values. The getMap url would have something like &env=step1:1.0;step2:1.5; etc...

  <RasterSymbolizer>
    <Opacity>1</Opacity>
    <ColorMap type="ramp" extended="true">      
      <ColorMapEntry color="#000000" quantity="0" opacity="0" />
      <ColorMapEntry color="#0000FF" quantity="0.75" opacity="1" />
      <ColorMapEntry color="#00FF00" quantity="1.25" opacity="1" />
      <ColorMapEntry color="#FFFF00" quantity="1.75" opacity="1" />
      <ColorMapEntry color="#FF6600" quantity="2.25" opacity="1" />              
      <ColorMapEntry color="#FF0000" quantity="3.00" opacity="1" />              
    </ColorMap>
  </RasterSymbolizer>

I tried doing what http://docs.geoserver.org/latest/en/user/styling/sld-reference/rastersymbolizer.html suggested by using

<ColorMapEntry color="#0000FF" quantity="${env('step1',1)}"/>

but that didn't work. Geoserver throws

IllegalArgumentexception: Argument "quantityString" should not be null.

Which makes sense.

So the CQL expression didn't seem to work as I hoped. How do I get that to work or use the ogc function?

Using Geoserver 2.7.

  • 1
    Which version of GeoServer are you using? – simogeo Jul 6 '15 at 17:34
  • Should have included that. Geoserver 2.7.0 – JMD83 Jul 6 '15 at 17:43
3

It's been added since 2.7.1.

See release note here. Here the JIRA report.

Simone.

  • Do you know if the geoserver-2.7-SNAPSHOT community build includes CQL? I need to use the GRIB plugin which seems to only be available on the community builds. – JMD83 Jul 7 '15 at 15:33
  • 1
    Yes it should. Releases are cut from nightlies at a certain point in time (doing additional testings and so on). – simogeo Jul 7 '15 at 16:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.