Hi Andrea,

Yes, keeping 1 rule by SLD could be a possible workaround, but it would be 
difficult to manage at some level...
Actually we often use different rules (filtered by ENV values) in a same SLD, 
for different reasons, e.g. to handle:

-          reversed values on legends (values growing from bottom to top) : 1 
rule for GetMap queries and a 2nd one with reversed colormap entries for 
GetLegendGraphic queries

-          SQL Views layers which can return different columns from db tables 
(e.g. temperatures or pressures), which require different colormaps

-          different colormaps (e.g. ramp and values), selectable by ENV in the 
GetMap query

-          values from different bands in a GeoTIFF

-          different colormap resolution at different scales

-          etc...
I think many people uses multiple RasterSymbolyzer rules in one SLD: there are 
many discussions on the forums about GetLegend results for such an SLD.

Best regards,
Victor

From: [email protected] [mailto:[email protected]] On Behalf Of Andrea 
Aime
Sent: Thursday, June 16, 2016 1:28 PM
To: Victor.Sinceac <[email protected]>
Cc: [email protected]; Sylvain.Ladoire 
<[email protected]>
Subject: Re: [Geoserver-users] SLD RasterSymbolizer: ColorMapEntry variable 
substitution doesn't work when there are multiple rules in the SLD

Hi Victor,
no, we're aware it does not work when there are two layers in the request... 
it's odd to have two raster symbolizes in one style though...

Cheers
Andrea

On Thu, Jun 16, 2016 at 3:11 PM, Victor.Sinceac 
<[email protected]<mailto:[email protected]>> wrote:
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.<http://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]<mailto:[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<tel:%2B44%20%280%29%201509%20601141>
Fax: +44 (0) 1509 601091<tel:%2B44%20%280%29%201509%20601091>
Web: www.campbellsci.co.uk<http://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]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geoserver-users



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i 
file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo 
è consentito esclusivamente al destinatario del messaggio, per le finalità 
indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne 
il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di 
procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro 
sistema. Conservare il messaggio stesso, divulgarlo anche in parte, 
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, 
costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for the 
attention and use of the named addressee(s) and may be confidential or 
proprietary in nature or covered by the provisions of privacy act (Legislative 
Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in 
accord with its purpose, any disclosure, reproduction, copying, distribution, 
or either dissemination, either whole or partial, is strictly forbidden except 
previous formal approval of the named addressee(s). If you are not the intended 
recipient, please contact immediately the sender by telephone, fax or e-mail 
and delete the information in this message that has been received in error. The 
sender does not give any warranty or accept liability as the content, accuracy 
or completeness of sent messages and accepts no responsibility  for changes 
made after they were sent or for other risks which arise as a result of e-mail 
transmission, viruses, etc.

-------------------------------------------------------
------------------------------------------------------------------------------
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