Cursor coordinates

Abe Gillespie agillesp at VT.EDU
Fri Feb 4 14:44:46 EST 2005


In Javascript you need to use: window.status = "your coordinate text".
Firefox seems to have issues with this ... anyone know why the text
often doesn't show up?

To do the actual calculation you need to take your current extents and
find how many map units per pixel there is.  Something like:

mapWidth / imageWidth = map_units_per_pixel_in_x

Then you just need to multiply the above result by the current X
position:

mapX = map_units_per_pixel_in_x * imageX

It should be simple to figure out the Y.

There should be examples how to capture the current mouse X & Y either
in the dbox code or elsewhere on the internet (read: Google).

-Abe

On Feb 4, 2005, at 2:16 PM, Kevin Grootendorst wrote:

> Just wondering if anyone has a clue how to display the geographic
> coordinates of the cursor as it moves across the map frame?
> I'd like to display these coordinates on the webpage. I envision the
> coordinates changing on the fly, as the user moves the mouse around.
> Any ideas????
>
> Using MS 4.2, PHP 4.3.4, Win2000
>



More information about the mapserver-users mailing list