1

I'm trying to publish a layer with a style that allows the extended WMS request to specify what image bands to map to the RGB values. Based on existing examples I assumed that my SLD should have something like the following RasterSymbolizer element:

<RasterSymbolizer>            
        <ChannelSelection>
          <RedChannel>                  
            <SourceChannelName>
              <ogc:Function name="env">
               <ogc:Literal>redchan</ogc:Literal>
               <ogc:Literal>1</ogc:Literal>
              </ogc:Function>
            </SourceChannelName>
          </RedChannel>...

But the SLD validation fails with the following error:

Element 'SourceChannelName' is a simple type, so it must have no element information item [children]

I am following this documentation:

http://docs.geoserver.org/stable/en/user/styling/sld/reference/rastersymbolizer.html http://docs.geoserver.org/stable/en/user/styling/sld/extensions/substitution.html

Is there a way to do this or is it not supported for the ChannelSelection element? Are there any more examples and/or documentation for SLD variable substitution that I can look at?

0

The OGC specification for SLD is quite restrictive about where functions (or expressions) can be used. GeoServer relaxes those restrictions in a lot of places but not here.

You would need to extend the GeoTools SLD implementation to expect an expression there, rather than a simple type.

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.