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...

[215 byte] By [Zooma] at [2008-1-3]
# 1

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!

DaveBritton-VERTIGO at 2007-9-25 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 2

It works!

Really extra nice!

Thanks a lot...

Zooma at 2007-9-25 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 3
Hi!!

There`s a way to writte a polygon with the lat`s and long`s the user gives every time hi clicks the mouse?

germana at 2007-9-25 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...

Windows Live Developer Forums

Site Classified