[mapserver-users] WMS Filter using Logical Operator

Peter Lock rayonegro at gmail.com
Thu Jun 11 05:29:45 EDT 2009


Hi all,

I'm trying to do a WMS request using a SLD filter.
If I use a single comparison operator (PropertyIsLike) in my filter all
works fine, but when I use a combination of 2 PropertyIsLike operators using
a logical operator (And/Or) it looks like MapServer is only using the last
comparison operator.

This filter works fine; it shows all data where LOC_NAAM is like *MATH*:

<StyledLayerDescriptor version='1.0.0'>
  <NamedLayer>
    <Name>mylayer</Name>
    <UserStyle>
      <Title>xxx</Title>
      <FeatureTypeStyle>
        <Rule>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
              <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!"
matchCase="false">
                <ogc:PropertyName>LOC_NAAM</ogc:PropertyName>
                <ogc:Literal>*MATH*</ogc:Literal>
              </ogc:PropertyIsLike>
          </ogc:Filter>
          <LineSymbolizer>
            <Geometry>
              <PropertyName>center-line</PropertyName>
            </Geometry>
            <Stroke>
              <CssParameter name='stroke'>#0000ff</CssParameter>
              <CssParameter name='stroke-width'>2.0</CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


But the next filter shows all data where LOC_NAAM is like *WEG*, but also
the data where LOC_NAAM is not like *MATH*, which is incorrect: it should
show all data where LOC_NAAM contains both WEG and MATH:

<StyledLayerDescriptor version='1.0.0'>
  <NamedLayer>
    <Name>mylayer</Name>
    <UserStyle>
      <Title>xxx</Title>
      <FeatureTypeStyle>
        <Rule>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:And>
              <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!"
matchCase="false">
                <ogc:PropertyName>LOC_NAAM</ogc:PropertyName>
                <ogc:Literal>*MATH*</ogc:Literal>
              </ogc:PropertyIsLike>
              <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!"
matchCase="false">
                <ogc:PropertyName>LOC_NAAM</ogc:PropertyName>
                <ogc:Literal>*WEG*</ogc:Literal>
              </ogc:PropertyIsLike>
            </ogc:And>
          </ogc:Filter>
          <LineSymbolizer>
            <Geometry>
              <PropertyName>center-line</PropertyName>
            </Geometry>
            <Stroke>
              <CssParameter name='stroke'>#0000ff</CssParameter>
              <CssParameter name='stroke-width'>2.0</CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>


If I use these filters for a WFS request all works fine.

My question is: is it possible to use these logical operators in a filter in
a WMS request? And if so, how has this to be done?

I hope you can help me!

Best regards,

Peter Lock

-- 
View this message in context: http://n2.nabble.com/WMS-Filter-using-Logical-Operator-tp3061075p3061075.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list