Does anyone know how make the default Google map interface display long and lat coordinates in an info window when the user clicks on the map?
Header code:
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=..." type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(13.175771, -59.556885), 10);
map.setUIToDefault();
}
}
</script>
Body code:
<div id="map" style="width: 640px; height: 300px"></div>
google.maps.event.addListener(map, 'click', function(event) {
new google.maps.InfoWindow({
position: event.latLng,
content: event.latLng.toString()
}).open(map);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With