3

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.

1 Answer 1

4

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>
2
  • 1
    <ogc:PropertyIsEqualTo> <ogc:PropertyName>Aabningsgrad</ogc:PropertyName> <ogc:Literal>100</ogc:Literal> </ogc:PropertyIsEqualTo> Sep 15, 2016 at 16:27
  • @Andrea, I've corrected the SLD as per your comment.
    – nmtoken
    Sep 15, 2016 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.