[mapserver-dev] known issue with Filter implementation?

Yewondwossen Assefa yassefa at dmsolutions.ca
Wed May 28 11:12:29 EDT 2008


Bart,
   	
   The expressions out of the filters should place the brackets 
properly.  Quick tests on your filters using a postgis layer gives the 
following expressions:
( (BEHEERDER= 'R')  And  ( (LENGTH> 10000)  Or  (BEHEERDER= 'P') ) )

( (BEHEERDER= 'P')  Or  ( (LENGTH> 10000)  And  (BEHEERDER= 'R') ) )

  Not sure why you would get the same results. If you have specific data 
tests, I will do additional tests.

Best Regards,


bartvde at osgis.nl wrote:
> 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
> 
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
> 


-- 
----------------------------------------------------------------
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-dev mailing list