[mapserver-users] SLD and Spatial Filtering: what is working and what is not?
Marco Bagni
m.bagni at marcobagni.com
Mon Jun 13 09:40:18 PDT 2011
Hi all,
playing with the SLD feature and trying to use it in order to show with a
RED color only those polygons, in a coverage, that fit within a
user-defined fence I have found some things that seem to be broken:
The following SLD filter works fine:
<NamedLayer>
<Name>REQUESTED_LAYER_NAME</Name>
<UserStyle>
<Title>xxx</Title>
<FeatureTypeStyle>
<Rule>
<ogc:Filter>
<BBOX>
<PropertyName>Geometry</PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates>8.473,40.231 9,40.784</gml:coordinates>
</gml:Box>
</BBOX>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
This SLD file works as exepected, all the polygons outside the BBOX
rectangle are not displayed and those that fall within are displayed in
RED color.
eplacing the ogc:Filter with something more versatile like a fence (in the
example I have used exactly the same vertices of the BBOX rectangle given
above) it does not work. Why?
<NamedLayer>
<Name>REQUESTED_LAYER_NAME</Name>
<UserStyle>
<Title>xxx</Title>
<FeatureTypeStyle>
<Rule>
<ogc:Filter>
<Within>
<PropertyName>Geometry</PropertyName>
<gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>8.473,40.231 8.473,40.784 9,40.784 9,40.231
8.473,40.231</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Within>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
I have tried also DWithin with no results (the filter is applied but no
polygons are displayed). BTW sorry for my ignorance by what is the
difference between Within and DWithin? And where can I find some written
reference on the meaning of the Spatial Filters?
What am I doing wrong? What kind of ogc:Filters are available in the SLD
feature (applied to a WMS request)?
Since the documentation on this particular issue is very poor I am asking
the help of this community with the promise to produce, for the benefit of
us all, a short and effective HOWTO "recipe" when the problem shall be
sorted out.
Thanks in advance.
Marco Bagni
More information about the MapServer-users
mailing list