Hi!
I want to display the position of the mouse (lat/long) while it is over my
map and the exact position of the mouse when the map is clicked. Could
anybody help me with this?
Thanks in advance.
Luis
I am pretty sure the standard mouse coordinate display function is something like this:
function mapplet_mouse_moved(name,x,y)
{
with (Math)
{
tempstring = document.mapserv.mapsize.value;
mapsizeArray = tempstring.split(" ");
if (document.mapserv.imgext.value != '')
{
tempstring = document.mapserv.imgext.value;
imgextArray = tempstring.split(" ");
}
if (imgextArray)
{
coordx = imgextArray[0]*1+(x*(imgextArray[2]-imgextArray[0])/mapsizeArray[0]);
coordy = imgextArray[3]*1-(y*(imgextArray[3]-imgextArray[1])/mapsizeArray[1]);
}
else
{
coordx = '';
coordy = '';
}
window.status = "WGS-84 UTM X: " + round(coordx) + " Y: " + round(coordy);
}
}
function mapplet_mouse_exited(name)
{
window.status="";
}
We use this in our mapplet (java) based mapserver sites.
As far as displaying the coodinate when clicked, you just need to add a tool that passes the coordx and coordy values to a new window or something like that.
Good Luck
-Mike
