[mapserver-users] QueryObjects: What is displayed versuswhat is returned

Daniel Morissette morissette at dmsolutions.ca
Fri Jun 22 14:07:26 EDT 2001


David_Kriske at hilton.com wrote:
> 
> For instance, if I have two overlapping polygons in a layer, one has ATTRIBUTE =
> 1 and the other ATTRIBUTE = 2, and I do a $aopqueryobject->setExpression(  ?
> ([ATTRIBUTE] eq 1)  ?  ) and then I QueryUsingPoint using a point withing the
> two overlapping polygons, I get a map that highlights only the poly with
> ATTRIBUTE equal to 1 (correct behavior) but when I examine the queryresultobject
> using numresults, I see two items (the displayed one and the filtered one).
> 
> Should there be one or two items in the queryresult object in this case?  The
> problem is even though the map is correct, when I iterate through the
> resultobject to pull out attributes (and generate a list of highlighted items),
> I get the masked item as well as the highlighted one.
> 

The result object should contain only the object that matches the
expression... and that's the behavior that we do get with the GMap demo
when we do the same thing as you.

The only difference is that in our case the expression is hardcoded in
the mapfile, and you set it at runtime via PHP in your case.  I would
suggest that you try setting the expression for both the class and the
query object directly in the mapfile instead of via PHP and then call
queryusingpoint() and see if you result object still contains too many
results.

BTW, which version of PHP MapScript are you using?  3.4 I hope.
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.




More information about the mapserver-users mailing list