[mapserver-dev] known issue with Filter implementation?

bartvde at osgis.nl bartvde at osgis.nl
Wed May 28 05:26:37 EDT 2008


Hi list,

is it correct that Mapserver's Filter implementation does not deal with
operator precedence? 

It seems to me Mapserver does not place extra brackets in the SQL query, so
the standard SQL operator precedence (AND before OR etc.) prevails, and not
the one specified in the ogc:Filter. Can anybody confirm this?

For instance the following filters yield the same results with Mapserver
5.0.2, whereas they are different in the precedence:

SQL: BEHEERDER = 'R' AND (LENGTH > 10000 OR BEHEERDER = 'P')
Filter:
<ogc:And>
  <ogc:PropertyIsEqualTo>
    <ogc:PropertyName>BEHEERDER</ogc:PropertyName>
    <ogc:Literal>R</ogc:Literal>
  </ogc:PropertyIsEqualTo>
  <ogc:Or>
    <ogc:PropertyIsGreaterThan>
      <ogc:PropertyName>LENGTH</ogc:PropertyName>
      <ogc:Literal>10000</ogc:Literal>
    </ogc:PropertyIsGreaterThan>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>BEHEERDER</ogc:PropertyName>
      <ogc:Literal>P</ogc:Literal>
    </ogc:PropertyIsEqualTo>
  </ogc:Or>
</ogc:And>

versus:

SQL: (BEHEERDER = 'R' AND LENGTH > 10000) OR BEHEERDER = 'P'
Filter:
<ogc:Or>
  <ogc:PropertyIsEqualTo>
    <ogc:PropertyName>BEHEERDER</ogc:PropertyName>
    <ogc:Literal>P</ogc:Literal>
  </ogc:PropertyIsEqualTo>
  <ogc:And>
    <ogc:PropertyIsGreaterThan>
      <ogc:PropertyName>LENGTH</ogc:PropertyName>
      <ogc:Literal>10000</ogc:Literal>
    </ogc:PropertyIsGreaterThan>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>BEHEERDER</ogc:PropertyName>
      <ogc:Literal>R</ogc:Literal>
    </ogc:PropertyIsEqualTo>
  </ogc:And>
</ogc:Or>

TIA.

Best regards,
Bart



More information about the mapserver-dev mailing list