setfilter expression issue

Daniel Morissette dmorissette at MAPGEARS.COM
Fri Sep 14 09:29:51 EDT 2007


Gagan Bansal wrote:
> Hi
> I am using MapServer 4 Windows - version 2.2.5 with php
> I am unable to set the expression for the setfilter method. 
> 
> $oLayer->setFilter("\"BLDGNAME='shop'\""); 
> 
> Is it correct format?
> 

You have two options:

1- The preferred (most efficient):

  $oLayer->set('filteritem', 'BLDGNAME');
  $oLayer->setFilter('shop');

2- Using logical expression (just as in a mapfile, the whole expression 
has to be delimited by round brackets and the attribute name by square 
brackets):

  $oLayer->setFilter("('[BLDGNAME]'='shop')");


Daniel
-- 
Daniel Morissette
http://www.mapgears.com/



More information about the mapserver-users mailing list