Hi,

Color variable substitution works only when there is ONE SINGLE RULE in the 
SLD; when the SLD contains 2 or more rules, the variable substitution is broken 
and default color values are always used.
It is reproducible on any raster layer in GeoServer 2.8.3/2.9.0.

Did someone found a workaround to this issue?

Here below a  minimalist SLD (for DEM geotiff layer) with 2 similar rules with 
reversed default colors. The filter allows the client to explicitly call the 
1st rule by using "ENV=rule:1".
A WMS GetMap query with a different color value for a color (e.g. 
"ENV=rule:1;c1:%230000FF”, i.e. Blue instead default Read) returns as follows:
 - NOK: the default (Red) color when the SLD contain 2 rules
 - OK:    the ENV value (Blue) color send in the query if the SLD only contains 
the 1st rule (i.e. the 2nd is manually removed from the SLD)

<Rule><Name>Red_Water</Name>
     
<ogc:Filter><ogc:PropertyIsEqualTo><ogc:Literal>1</ogc:Literal><ogc:Function 
name="env"><ogc:Literal>rule</ogc:Literal></ogc:Function></ogc:PropertyIsEqualTo></ogc:Filter>
     
<RasterSymbolizer><Opacity>1.0</Opacity><ChannelSelection><GrayChannel><SourceChannelName>1</SourceChannelName></GrayChannel></ChannelSelection>
          <ColorMap type="intervals"><ColorMapEntry color= 
"${env('c1','#FF0000')}" quantity= "10"/><ColorMapEntry color= 
"${env('c2','#000000')}" quantity= "9000"/></ColorMap>
     </RasterSymbolizer>
</Rule>

<Rule><Name>Black_Water</Name><ogc:Filter><ogc:PropertyIsEqualTo><ogc:Literal>2</ogc:Literal><ogc:Function
 
name="env"><ogc:Literal>rule</ogc:Literal></ogc:Function></ogc:PropertyIsEqualTo></ogc:Filter>
     
<RasterSymbolizer><Opacity>1.0</Opacity><ChannelSelection><GrayChannel><SourceChannelName>1</SourceChannelName></GrayChannel></ChannelSelection>
          <ColorMap type="intervals"><ColorMapEntry color= 
"${env('c1','#000000')}" quantity= "10"/> <ColorMapEntry color= 
"${env('c2','#FF0000')}" quantity= "9000"/></ColorMap>
     </RasterSymbolizer>
</Rule>

Many Thanks,
Victor
________________________________
This message is subject to and does not create or vary any contractual 
relationship between Campbell Scientific Limited, its subsidiaries or 
affiliates ("CSL") and you. Internet communications are not secure and 
therefore CSL does not accept legal responsibility for the contents of this 
message. The message is intended for the addressee only and its contents and 
any attached files are strictly confidential. If you have received it in error, 
please telephone +44 (0)1509 601141 or email [email protected]. 
Thank you.
Campbell Scientific Ltd.
Company Registration Number: 1933935 (England and Wales) Registered Address: 
Campbell Park, 80 Hathern Road, Shepshed, Loughborough, Leicestershire LE12 
9GX, UK
Tel: +44 (0) 1509 601141
Fax: +44 (0) 1509 601091
Web: www.campbellsci.co.uk

________________________________

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to