0

I want to use a NamedStyle inside a UserStyle for the ElseFilter of my SLD-Definition:

<NamedLayer>
<Name>MyLayer</Name>
<UserStyle>
<FeatureTypeStyle>

<Rule>
<Name>Selected</Name>
<ogc:Filter>
<ogc:PropertyIsEqualTo><ogc:PropertyName>my_id</ogc:PropertyName><ogc:Literal>31117</ogc:Literal></ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#008000</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#BD0026</CssParameter>
<CssParameter name="width">30</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>

<Rule>
<Name>Others</Name>
<ElseFilter/>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>

</FeatureTypeStyle>
</UserStyle>

</NamedLayer>

Something like this:

<Rule>
<Name>Others</Name>
<ElseFilter/>
<NamedStyle>
    <Name>the_style</Name>
</NamedStyle>
</Rule>
2
  • what would that even mean? why do you want to do this? – Ian Turton Apr 25 '18 at 12:20
  • I want only one feature to be drawn by userstyle and all other features should be displayed with Default style from the mapfile – Max Apr 25 '18 at 12:33
2

AFAIK MapServer doesn't use SLD internally, but will accept an SLD as part of a GetMap request, either by reference through an SLD& parameter or directly as the value of an SLD_BODY& parameter.

In any case MapServer supports the SLD standard, and allows for named styles, so it should be possible to add your style on top of the default style if required.

1
  • mapserver.org/ogc/sld.html#named-styles-support The named style works under NamedLayers, but it seems to be not valid inside of UserStyles. I want an IF - ELSE Statement, so that inside the if clause it should apply my userstyle and inside the else clause it should apply the default named style. Do you have any idea? Thanks – Max Apr 26 '18 at 8:13

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.