Need help with Layer->QueryByPoint

Jeff Portwine jdport at VERITIME.COM
Mon Apr 4 09:57:02 EDT 2005


Hello,

I'm trying to understand how to use the QueryByPoint function in php/mapscript, but I really don't understand the description of the function or how it is supposed to work.   

Let me explain what I'm trying to do I guess, and what I hope this function can accomplish...
I have a bunch of addresses complete with latitudes and longitudes in a database (it's just a postgres table, I'm not using PostGIS).   I read the locations from this table and I plot points on the map at those locations, colorcoding them by various criteria.   I then want to be able to click on those points and bring up another web page specific to those sites.   

When I first started this project, I looked at queryByPoint but couldn't figure out how to use it so I used another method... I turned the map into a client side image map, converting the projected lat/long values into pixel values and making those points clickable.    However, this method breaks down when you zoom in on the map too far.   It works for a while, but at when zoomed in past a  certain point it no longer works and makes the entire map link to one point.    I'm not sure why this happens, but it's very repeatable and I can't see anything in my code that would cause this effect.  So, i'm back to looking at how queryByPoint works.

My points are drawn in a layer created in mapscript, it doesn't initially exist in my mapfile.   There is no shapefile associated with the points and thus there is no dbf file associated with them.   The only thing I have is the postgresql table from which I'm reading the locations.   I'm not sure if this is something queryByPoint can access.

from the documentation:
        The query is performed on all the shapes that are part of a CLASS 
        that contains a TEMPLATE value or that match any class in a
        layer that contains a LAYER TEMPLATE value.

I'm not sure what this means... what should the template value be, and what exactly is the query?   Is it just an SQL query?  Do I need to be using postGIS or another spatially enabled database to do this?

        Mode is MS_SINGLE or MS_MULTIPLE depending on number of results
        you want. 
        Passing buffer <=0 defaults to tolerances set in the map file 
        (in pixels) but you can use a constant buffer (specified in 
        ground units) instead.

Where do these results go?   The function only returns an integer that tells me whether it had success or failure, so how do I access the query results?

I guess that's enough questions for now... thanks in advance for any pointers.

-Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050404/81dea72c/attachment.html


More information about the mapserver-users mailing list