Colormap variable substitution not working if multiple layers are provided in WMS call

Description

The issue is related to cql expressions in the rastersymbolizer style element to make the color map dynamic as described here: http://docs.geoserver.org/2.8.x/en/user/styling/sld-reference/rastersymbolizer.html#cql-expressions

It works basically, but as soon as more than one layer are passed through the layers-parameter in a WMS call the cql parameters are ignored and the defined default values are applied.

As an example, the threshold1-parameter in the following WMS call is completely ignored because two layers are passed:
http://server:8080/geoserver/prog/wms?service=WMS&version=1.1.0&request=GetMap&layers=layer_1,layer_raster&ENV=threshold1:0&styles=&bbox=8..,48..,8..,48..&width=767&height=768&srs=EPSG:4326&format=application/openlayers

The issue was confirmed in the GeoServer user group:
http://osgeo-org.1560.x6.nabble.com/Variable-substitution-not-working-if-multiple-layers-are-provided-in-WMS-call-td5271011.html

Environment

None

Activity

Show:
Andrea Aime
February 15, 2017, 11:48 AM

Mass closing all resolved issues not modified in the last 4 weeks

Andrea Aime
July 22, 2016, 5:36 PM

Fixed at the very end of my "bug stomp" day, should work fine but I could use some checks. It should be in any geoserver nightly build dated July 23rd or successive: http://ares.boundlessgeo.com/geoserver/

Victor Sinceac
June 16, 2016, 3:06 PM

As remarked by Andrea, such a fix would also fix a related issue acting on SLD with multiple rules for RasterSymbolizer.
See full details in discussion http://osgeo-org.1560.x6.nabble.com/SLD-RasterSymbolizer-ColorMapEntry-variable-substitution-doesn-t-work-when-there-are-multiple-rules-D-td5272032.html#a5272056

Mauro Bartolomeoli
June 15, 2016, 12:06 PM
Fixed

Assignee

Andrea Aime

Reporter

M

Fix versions

Affects versions