2

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.

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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