[mapserver-users] QueryObjects: What is displayed versus what is returned

David Kriske David_Kriske at Hilton.com
Thu Jun 21 15:40:51 PDT 2001






I am currently using PHP Mapscript to display a polygon layer, where the display
of this layer is restricted to only polygons that have a certain attribute,
using the $class->setExpression() method.  What I want to do is allow the user
to click on a given polygon displayed like this, and have the poly highlighted.
To do this, I use the QueryUsingPoint method on a queryobject that is defined in
the map file (where the query is restricted using the same setExpression method
as above).  All of this works fine.



The problem is, I take the same queryresultobject that the QueryUsingPoint
method returns and, for each item in the resultobject, I use an index field
stored as an attribute to retrieve info from a database using that key.  Thus,
when the user clicks on a polygon, the resulting image has the polygon
highlighted and a link is provided to bring up supplementary information in a
new window pulled from a databse.



Unfortunately, if there is a polygon that has been "masked out" due to its
attribute not satisfying the Expression set through the setExpression method but
the user clicks in the area where the polygon WOULD HAVE BEEN had it not been
excluded, the queryresultobject will still return it as a record, and thus my
PHP script will in turn generate a link to it.  Thus, while the excluded
polygons are not displayed, by clicking on the image and using QueryUsingPoint,
the poly is still returned in the result set.



Is there any way around this issue?



Thanks for your help!



David








More information about the MapServer-users mailing list