Get latitude longitude coordinates on a click event
Hi,
I've just started using Virtual Earth...
Is there someone who can tell me the code to get a point latitude and longitude coordinates when the user clicks on the map?
Thanks a lot...
Hi,
I've just started using Virtual Earth...
Is there someone who can tell me the code to get a point latitude and longitude coordinates when the user clicks on the map?
Thanks a lot...
Well it just so happens that I have this exact little snippet for you ... I copy the coords to the clipboard also to be extra nice ![]()
map.AttachEvent('onclick', HandleClick);
function HandleClick()
{
mapXPixel = event.clientX - map.GetLeft();
mapYPixel = event.clientY - map.GetTop();
latLong = map.PixelToLatLong(mapXPixel,mapYPixel);
alert('Latitude=' + latLong.Latitude + ', Longitude=' + latLong.Latitude);
var tempCopy = document.getElementById('Some ID');
tempCopy.value = 'Latitude=' + latLong.Latitude + ', Longitude=' + latLong.Latitude;
Copy = tempCopy.createTextRange();
Copy.execCommand('Copy');
}
Should do the trick!
There`s a way to writte a polygon with the lat`s and long`s the user gives every time hi clicks the mouse?