0

I was trying to animate a single raster layer with a variable substitution in SLD. I've followed the Geoserver documentation http://docs.geoserver.org/stable/en/user/styling/sld/extensions/substitution.html#sld-variable-substitution How can I animate a single layer by using a variable substitution on Geoserver Style? This is part of the style I was using:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptorxmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"mlns:se="http://www.opengis.net/se"xmlns:xlink="http://www.w3.org/1999/xlink"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0"si:schemaLocation="http://www.opengis.net/sldhttp://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
  <Name>Umidade Relativa Mínima</Name>
  <UserStyle>
     <Name>Style</Name>
     <Title>Style for a Coverage layer.</Title>
     <FeatureTypeStyle>
        <Rule>
           <RasterSymbolizer>
              <ChannelSelection>
                 <GrayChannel>
                    <SourceChannelName>1</SourceChannelName>
                 </GrayChannel>
              </ChannelSelection>
              <ColorMap type="ramp">
                 <ColorMapEntry color="#ff0000" quantity="0.60" opacity="${env('op',0)}" label="20" />
                 <ColorMapEntry color="#00ff00" quantity="0.70" opacity="1.0" label="30" />
              </ColorMap>
           </RasterSymbolizer>
        </Rule>
     </FeatureTypeStyle>
  </UserStyle>

and this is the query I was using to try to animate: http://localhost:8080/geoserver/wms/animate?&format=image/gif;subtype=animated&format_options=gif_loop_continuosly:true&layers=terrama2_4:view4&aparam=op&avalues=0;0.2;0.5;1

  • what does happen? is there an error message? – Ian Turton Mar 2 '18 at 14:38
  • When I checked the Geoserver Log, it doesn't show any error message. It appears like a normal layer request. the parameters I've sent in the query are there in the log and nothing happens. – Pedro Ribas Mar 2 '18 at 16:27
  • Could you add the GeoServer version you're using? – Andrea Aime Mar 6 '18 at 13:18
  • I'm using Geoserver 2.11.1 – Pedro Ribas Mar 7 '18 at 16:51
2

The animator does not set environment variables (not directly), check the documentation for animator and environment variables:

http://docs.geoserver.org/stable/en/user/tutorials/animreflector.html#overview http://docs.geoserver.org/stable/en/user/styling/sld/extensions/substitution.html

It says that "aparam" is a KVP parameter replaced in the request. So with that setup you'll end up adding "&op=0", then "&op=0.25" and so on, which does nothing since the "op" parameter is unknown.

To make it do what you want something like this might work "aparam=env&avalues=op:0,op:0.25,op:0.5,op:1" so that the expansion would add "&env=op:0" then "&env=op:0.25" and so on.

I agree that setting directly env variable would be nice, if you want that to happen follow this guide: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

  • Well, I used the parameters like you said, but it isn't working yet. I've tried to send the parameters like you suggest me "aparam=env&avalues=op:0,op:0.25,op:0.5,op:1" and the layer still static. – Pedro Ribas Mar 5 '18 at 17:19

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.