[GIS] SLD based on several Value Fields

geoserversld

How do I write a SLD file based on more than one Value field for each Name. I would like to symbolize by two fields "Type" and "Aabningsgrad".
Some features I would like to see with the combination Type = Ventil and Aabningsgrad = 0, and others I would like to show with combination Type = Ventil and Aabningsgrad = 100.

How do I write that?

I looked at this:
SLD based on two attribute values
But unfortunately it didn't do the trick for me.

Best Answer

You need to use rules with an And Filter something like:

<sld:Rule>
    <sld:Name>Style 1</sld:Name>
    <sld:Abstract>Type = Ventil and Aabningsgrad = 0</sld:Abstract>
    <ogc:Filter>
        <ogc:And>
            <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>type</ogc:PropertyName>
                <ogc:Literal>Ventil</ogc:Literal>
            </ogc:PropertyIsEqualTo>
            <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>Aabningsgrad</ogc:PropertyName>
                <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>
        </ogc:And>
    </ogc:Filter>
    <sld:PolygonSymbolizer>
        <sld:Fill>
            <sld:CssParameter name="fill">#FFCCB3</sld:CssParameter>
        </sld:Fill>
    </sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
    <sld:Name>Style 2</sld:Name>
    <sld:Abstract>Type = Ventil and Aabningsgrad = 100</sld:Abstract>
    <ogc:Filter>
        <ogc:And>
            <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>type</ogc:PropertyName>
                <ogc:Literal>Ventil</ogc:Literal>
            </ogc:PropertyIsEqualTo>
            <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>Aabningsgrad</ogc:PropertyName>
                <ogc:Literal>100</ogc:Literal>
            </ogc:PropertyIsEqualTo>
        </ogc:And>
    </ogc:Filter>
    <sld:PolygonSymbolizer>
        <sld:Fill>
            <sld:CssParameter name="fill">#B3CCFF</sld:CssParameter>
        </sld:Fill>
    </sld:PolygonSymbolizer>
</sld:Rule>