In Geoserver, a have a SLD style with a rule that looks like this
<Rule>
<ogc:Filter>
<ogc:PropertyIsGreaterThan>
<ogc:Function name="env">
<ogc:PropertyName>
property
</ogc:PropertyName>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>value1</ogc:Literal>
<ogc:Literal>0</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsGreaterThan>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">
#ff0000
</CssParameter>
<CssParameter name="fill-opacity">
0.5
</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
In the WMS request, i send an env parameter, specifing the property
and the value1
parameters for dynamic sld substitution. The property
parameter gets a value of an attribute name that exists on the layer I want to display the style with.
My solution won't work. I get an exception, saying:
The requested style cannot be used with this layer. The style specifies an attribute property and the layer is: ...
Is there a way to set the attribute name dynamically via sld substitution in Geoserver? And if yes, how can I achive that?
I am using Geoserver 2.7.2
Btw. this works:
<ogc:PropertyIsGreaterThan>
<ogc:PropertyName>
Einwohner
</ogc:PropertyName>
<ogc:Function name="env">
<ogc:Literal>value1</ogc:Literal>
<ogc:Literal>0</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsGreaterThan>
cvc-complex-type.2.4.d: Invalid content was found starting with element 'ogc:Function'. No child element is expected at this point.
value1
is, the filter now always includes all objects of the layer.