Problem with spatial filters and SLD parsing

J. Parapar listario at GMAIL.COM
Tue Jul 19 18:07:59 EDT 2005


Hi all.

I am having problems with spatial filters (DWithin,Intersects) in SLD
files. The SLD files in question have two rules (see below), one with
the spatial filter and the other with an ElseFilter, each one with its
respective symbolizer. The problem is that only the features resulting
from the spatial filter are represented, the "else features" do not appear.
So, I wonder if I am doing something wrong or there is a Mapserver
problem with the ElseFilter rule when a spatial filter is applied. It
seems like the ElseFilter rule was not taken into account.

I have tried with an IsEqualTo filter instead of the spatial one and it
works well.


I am using Mapserver 4.6.0.

The sld files are like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- a named layer is the basic building block of an sld document -->
<NamedLayer>
<Name>Provincias</Name>
<!-- with in a layer you have Named Styles -->
<UserStyle>
     <FeatureTypeStyle>
       <Rule>
         <Filter>
                <DWithin>
                        <PropertyName>geometria</PropertyName>
                        <Distance units="m">10</Distance>
                        <Point name="1" SRS="EPSG:23029">
                               
<coordinates>632266.666667,4800799.999999 </coordinates>
                        </Point>
                </DWithin>
        </Filter>
         <PolygonSymbolizer>
                <Fill>
                        <CssParameter name="fill">#0000FF</CssParameter>
                </Fill>
                <Stroke>
                        <CssParameter name="stroke">#0000FF</CssParameter>
                </Stroke>
         </PolygonSymbolizer>
       </Rule>
       <Rule>
        <ElseFilter/>
         <PolygonSymbolizer>
                <Fill>
                        <CssParameter name="fill">#FF0000</CssParameter>
                </Fill>
                <Stroke>
                        <CssParameter name="stroke">#000000</CssParameter>
                </Stroke>
         </PolygonSymbolizer>
       </Rule>
     </FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>


The following sld, with an "IsEqualTo" filter, works well:


<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- a named layer is the basic building block of an sld document -->
<NamedLayer>
<Name>Provincias</Name>
<!-- with in a layer you have Named Styles -->
<UserStyle>
     <FeatureTypeStyle>
       <Rule>
         <Filter>
                <PropertyIsEqualTo>
                        <PropertyName>ine_prov</PropertyName>
                        <Literal>27</Literal>
                </PropertyIsEqualTo>
        </Filter>
         <PolygonSymbolizer>
                <Fill>
                        <CssParameter name="fill">#0000FF</CssParameter>
                </Fill>
                <Stroke>
                        <CssParameter name="stroke">#000000</CssParameter>
                </Stroke>
         </PolygonSymbolizer>
       </Rule>
       <Rule>
        <ElseFilter/>
         <PolygonSymbolizer>
                <Fill>
                        <CssParameter name="fill">#FF0000</CssParameter>
                </Fill>
                <Stroke>
                        <CssParameter name="stroke">#000000</CssParameter>
                </Stroke>
         </PolygonSymbolizer>
       </Rule>
     </FeatureTypeStyle>
</UserStyle>
</NamedLayer>


Thank you very much in advance,
Jorge



More information about the mapserver-users mailing list