From iShare 6.0, due to the change in the way that Multiple Rules are handled i.e. Rules now apply to all that match not just the first match it finds, the solution is to use the <ElseFilter/> in the Rule which is used to match all not-otherwise-matched features. This goes in the Rule in the place that a Filter would normally occupy, e.g. in this simplified SLD, there’s a Rule with a Filter to match features with a crime_type value of Vehicle crime and a second Rule that uses ElseFilter to apply to all other features. Without the ElseFilter, every feature would have a fill colour of #FF8000. Code Block |
---|
language | xml |
---|
title | Example ElseFilter |
---|
collapse | true |
---|
| <Rule>
<Name>Vehicle crime</Name>
<Description>
<Title>Vehicle crime</Title>
</Description>
<Filter>
<PropertyIsEqualTo>
<PropertyName>crime_type</PropertyName>
<Literal>Vehicle crime</Literal>
</PropertyIsEqualTo>
</Filter>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<SvgParameter name="fill">#000080</SvgParameter>
</Fill>
<Stroke>
<SvgParameter name="stroke">#000000</SvgParameter>
</Stroke>
</Mark>
<Size>7</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<Name>Other crime</Name>
<Description>
<Title>Other crime</Title>
</Description>
<ElseFilter />
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<SvgParameter name="fill">#FF8000</SvgParameter>
</Fill>
<Stroke>
<SvgParameter name="stroke">#000000</SvgParameter>
</Stroke>
</Mark>
<Size>7</Size>
</Graphic>
</PointSymbolizer>
</Rule> |
|