Problem with spatial filters and SLD parsing

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Wed Jul 20 07:07:49 PDT 2005


Hi There,

  Effectivly the spatial filter won't work with the else filter. There 
is a note on that issue in the docs 
(http://mapserver.gis.umn.edu/doc/sld-howto.html) and also a bug related 
to that http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1427.  It 
should be adressed before the next release.

Later,


J. Parapar wrote:
> 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
> 
> 

-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



More information about the MapServer-users mailing list