[Mapserver-users] querybyattributes logical expression

AARON KONING aaronkoning at shaw.ca
Wed May 26 14:45:54 EDT 2004


I figured this out. The query string is different for different conditions:

For Shapefiles:
  For '>' '<' '>=' '<=' :
        ([AREA] > 4000000)
  For '=' :
        ('[NAME]' > 'prince george')

For PostGIS:
  For numeric fields:
        (AREA > 4000000)
  For non-numeric fields:
        (NAME = 'prince george')

Thanks for the help all,
Aaron




----- Original Message -----
From: "Ryan, Adam" <ARyan at co.linn.or.us>
Date: Wednesday, May 26, 2004 11:24 am
Subject: RE: [Mapserver-users] querybyattributes logical expression

> 
> Using "([AREA] > 4000000)" works for me.  Silly question: Are you 
> sure your
> Area field is numeric?  
> 
> Adam 
> 
> -----Original Message-----
> From: AARON KONING [aaronkoning at shaw.ca] 
> Sent: Wednesday, May 26, 2004 10:54 AM
> To: Mapserver-users at lists.gis.umn.edu
> Cc: Eric Bridger
> Subject: Re: [Mapserver-users] querybyattributes logical expression
> 
> 
> Hi,
> 
> I have also used different operators in class expressions. I tried 
> yoursuggestion but it did not work. Strangely the single quotes 
> are needed
> regardless of the data type of the field. So that the following 
> query does
> work:
> 
> $queryString = "('[AREA]' = '10')"
> $queryItem = 'AREA';
> > >    $map->querybyattributes($queryitem,$queryString,MS_MULTIPLE);
> 
> 
> 
> ----- Original Message -----
> From: Eric Bridger <eric at gomoos.org>
> Date: Wednesday, May 26, 2004 4:03 am
> Subject: Re: [Mapserver-users] querybyattributes logical expression
> 
> > At 11:11 PM 05/25/2004 -0700, AARON KONING wrote:
> > >Hi List,
> > >
> > >Just wondering if anyone has had success using 
> querybyattributes with 
> > >the '>', '<', '>=', '<=' operators? I have
> > been using the 'NOT', 'AND', 'OR',
> > >and '=' operators with success.
> > >
> > >The following statement fails:
> > >
> > >    $queryString = "('[AREA]' > '10')"
> > >    $queryItem = 'AREA';
> > >    $map->querybyattributes($queryitem,$queryString,MS_MULTIPLE);
> > 
> > I haven't used querybyattributes() but have use comparison
> > operators in CLASS EXPRESSION's.
> > I would try:
> > "([AREA] > 10)"  i.e. these are number values not strings.
> > 
> > _______________________________________________
> > Mapserver-users mailing list Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> > 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 




More information about the mapserver-users mailing list