[mapserver-users] Querying by point?

Stephen Lime steve.lime at dnr.state.mn.us
Tue Jul 17 16:23:03 EDT 2001


Unless you're points are in a shapefile then there's no way for the MapServer
to query them. Sounds like what you want to do is take a click from a map
and query the SQL database, sort of the reverse of drawing. The code to 
take an image click and turn it into a map coordinate is available lots of places.
You can take that coordinate (ie. lat/lon) and create a SQL statement with
it "select * from table where x > minx and x < maxx and y > miny and y < maxy".
Where the min and max values are based on the computed map coordinate
plus some buffer. That's essentially how point based MapServer queries work
anyway. Does that make sense?

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Mike Neuman" <mcn2 at engarde.com> 07/13/01 10:35PM >>>
  I'm trying to dynamically annotate my map and then allow the user to click
on the areas to get more information on each. Ideally, I'd like to do this
with a clientside map.

  I annotate the map by:

  $point = new pointObj();
  $point->{y} = (SQL latitude);
  $point->{x} = (SQL longitude);
  $point->draw($map, $layer, $img, "points", (SQL label));

  Obviously, this doesn't allow you to do a queryUsingPoint... Any
suggestions on how I can change my code to allow point querying?

  Thanks!

-Mike






More information about the mapserver-users mailing list