Hi,
I am here to enquire on how will I be able to get the Current LatLon
from Google MAP on mouse click?
I know that we have to add an event listener. I've done that. I am on
the last step to the success of this question.
I used the "fromDivPixelToLatLng" method provided by the Google Map
API.
However, right now, I am using 1,1 as the pixel. Which I believe it's
not right. How can I get my pixel (the point whereby my mouse is
clicking) from the map?
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
GEvent.addListener(map, "click", GetLatLng);
}
function GetLatLng(e) {
var pixel = new GPoint(1, 1); <--- RIGHT HERE.
var GLatLng = map.fromDivPixelToLatLng(pixel);
document.getElementById("tbxLat").value = GLatLng.lat();
document.getElementById("tbxLong").value = GLatLng.lng();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---