[mapserver-users] quickly finding which point on map is nearest to mouse click

Lowell Filak lfilak at medinaco.org
Mon Apr 8 14:18:27 PDT 2002


Sounds to me like your on the right path. If you use a buffer on the pick point to select any nearby points and then use distanceToPoint to decide which is closest.
Lowell F.

The following message was sent by "Scott D Cogan" <cogansco at msu.edu> on Mon, 8 Apr 2002 14:50:47 -0400.

> I have a map with certain lat/lon coordinates marked as sites.  I would like
> users to be able to click on the map and have information for the nearest
> site become highlighted.  To do this, I have converted the mouse click
> coordinates to lat/lon coordinates which are mapped.  Then I am planning on
> calculating for each site, the distance between the click and the site, and
> storing the remembering the closest one.  Is there a quicker way to do this?
> Would it be beneficial to use the distanceToPoint function in mapscript?
> -scott




More information about the MapServer-users mailing list