[Mapserver-users] SLD Filters (boolean operators)
Yewondwossen Assefa
assefa at dmsolutions.ca
Wed Jul 28 11:02:56 PDT 2004
Jeremy,
The <OR> operator takes exactly 2 arguments, so It is not possible to
have more that 2. But you can combine several OR statements to do what
you need. For example a filter like this <OR><OR>A B</OR>C</OR> is
equivalent to ((A OR B) OR C).
Later,
Jeremy Wiebe wrote:
> Hi there, (sorry about the previous email from me, slipped with the send
> button. :-( )
>
> Can anyone tell me if it is possible to group a sequence of <OR> operators
> in an SLD filter expression with MapServer?
>
> I'm working on filtering a list of points and displaying the matches with
> one symbol and the rest with another symbol. From the Filter Encoding
> Implementation Specification it seems that it should be possible to do at
> least 2 rules in an <OR> statement, but it is unclear if you can have more
> than that within an <OR>...
>
> The SLD I figured out is as follows: (The problem I have with it is it grows
> quite fast when there are lots of points to match)
>
> <StyledLayerDescriptor version="1.0.0">
> <NamedLayer>
> <Name>property</Name>
> <UserStyle>
> <Title>PropertyFilter</Title>
> <FeatureTypeStyle>
> <Rule>
> <Filter>
> <PropertyIsEqualTo>
> <PropertyName>PROPERTY_ID</PropertyName>
> <Literal>101643</Literal>
> </PropertyIsEqualTo>
> </Filter>
> <PointSymbolizer>
> <Geometry>
> <PropertyName>locatedAt</PropertyName>
> </Geometry>
> <Graphic>
> <Mark>
> <WellKnownName>star</WellKnownName>
> <Fill>
> <CssParameter name="fill">#00ffff</CssParameter>
> </Fill>
> </Mark>
> <Size>25.0</Size>
> </Graphic>
> </PointSymbolizer>
> </Rule>
> <Rule>
> <Filter>
> <PropertyIsEqualTo>
> <PropertyName>PROPERTY_ID</PropertyName>
> <Literal>101005</Literal>
> </PropertyIsEqualTo>
> </Filter>
> <PointSymbolizer>
> <Geometry>
> <PropertyName>locatedAt</PropertyName>
> </Geometry>
> <Graphic>
> <Mark>
> <WellKnownName>star</WellKnownName>
> <Fill>
> <CssParameter name="fill">#00ffff</CssParameter>
> </Fill>
> </Mark>
> <Size>25.0</Size>
> </Graphic>
> </PointSymbolizer>
> </Rule>
> <Rule>
> <ElseFilter />
> <PointSymbolizer>
> <Geometry>
> <PropertyName>locatedAt</PropertyName>
> </Geometry>
> <Graphic>
> <Mark>
> <WellKnownName>circle</WellKnownName>
> <Fill>
> <CssParameter name="fill">#fff798</CssParameter>
> </Fill>
> </Mark>
> <Size>15</Size>
> </Graphic>
> </PointSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
>
> Now, what I'd like to be able to do is:
>
> <StyledLayerDescriptor version="1.0.0">
> <NamedLayer>
> <Name>property</Name>
> <UserStyle>
> <Title>PropertyFilter</Title>
> <FeatureTypeStyle>
> <Rule>
> <Filter>
> <OR>
> <PropertyIsEqualTo>
> <PropertyName>PROPERTY_ID</PropertyName>
> <Literal>101643</Literal>
> </PropertyIsEqualTo>
> <PropertyIsEqualTo>
> <PropertyName>PROPERTY_ID</PropertyName>
> <Literal>101005</Literal>
> </PropertyIsEqualTo>
> <PropertyIsEqualTo>
> .... and so on...
> </PropertyIsEqualTo>
> </OR>
> </Filter>
> <PointSymbolizer>
> <Geometry>
> <PropertyName>locatedAt</PropertyName>
> </Geometry>
> <Graphic>
> <Mark>
> <WellKnownName>star</WellKnownName>
> <Fill>
> <CssParameter name="fill">#00ffff</CssParameter>
> </Fill>
> </Mark>
> <Size>25.0</Size>
> </Graphic>
> </PointSymbolizer>
> </Rule>
> <Rule>
> <ElseFilter />
> <PointSymbolizer>
> <Geometry>
> <PropertyName>locatedAt</PropertyName>
> </Geometry>
> <Graphic>
> <Mark>
> <WellKnownName>circle</WellKnownName>
> <Fill>
> <CssParameter name="fill">#fff798</CssParameter>
> </Fill>
> </Mark>
> <Size>15</Size>
> </Graphic>
> </PointSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
>
> Jeremy Wiebe
> Application Developer
> Linnet - The Land Systems Company
> 1600-444 St. Mary Avenue, Winnipeg, Manitoba, Canada, R3C 3T1
> Tel: 1-204-957-6452 Fax: 1-204-957-7568 email: jwiebe at linnet.ca
> http://www.linnet.ca
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
--
----------------------------------------------------------------
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