[mapserver-users] QueryByAttribute sometimes not working

Bistrais, Bob Bob.Bistrais at maine.gov
Fri Feb 18 12:54:22 EST 2011


After working with this a little more, I found another symptom-  Queries
on the layer work just fine when the application is loaded or refreshed.
But when I attempt a subsequent query on the layer, I get 0 results.
That suggests to me that the query, or layer, somehow needs to be
cleared.  Does anyone know how this can be done?  I don't see something
like a clearquery method.

 

________________________________

From: Bistrais, Bob 
Sent: Friday, February 18, 2011 10:39 AM
To: mapserver-users
Subject: [mapserver-users] QueryByAttribute sometimes not working

 

I'm having a strange problem with a queryByAttributes operation in a
MapServer application.  Most of the time it works correctly, but
sometimes it returns 0 results. 

 

It is querying a shapefile, if that gives a clue.

 

My first suspicion was the data wasn't matching the query expression.
But I checked and it appears to be correct.  To add to the confusion,
the application will sometimes select the queried feature, but not
always.  

 

Here is the query expression:

$query = "( ('[GEOCODE]' == '".$_SESSION['geocode']."') && ('[PLAN]' ==
'".$_SESSION['plan']."') && ('[LOT]' == '".$_SESSION['lot']."') )";

 

And here is the execution of the query:

$oLayer _parcels->queryByAttributes("GEOCODE", $query, MS_SINGLE);

 

I echoed back the query statement, and it looks correct.

 

This one is pretty confusing.  Has anyone seen anything like this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110218/d0588dcc/attachment.html


More information about the mapserver-users mailing list