Skip to content

Instantly share code, notes, and snippets.

@dwins
Created December 29, 2011 18:55
Show Gist options
  • Save dwins/1535599 to your computer and use it in GitHub Desktop.
Save dwins/1535599 to your computer and use it in GitHub Desktop.
Switch off rules in GeoServer styles based on query parameters
<?xml version="1.0" encoding="UTF-8"?>
<sld:UserStyle xmlns="http://www.opengis.net/sld"
xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml">
<sld:Name>Default Styler</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsGreaterThan>
<ogc:Function name="env">
<ogc:Literal>var1</ogc:Literal>
</ogc:Function>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsGreaterThan>
<ogc:PropertyIsGreaterThan>
<ogc:Function name="env">
<ogc:Literal>var2</ogc:Literal>
</ogc:Function>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsGreaterThan>
</ogc:And>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#ff0000</sld:CssParameter>
</sld:Fill>
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment