[Mapserver-users] SLD Filters (boolean operators)

Jeremy Wiebe Jwiebe at linnet.ca
Wed Jul 28 09:30:03 PDT 2004


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 




More information about the MapServer-users mailing list