Código HTML:
var geocoder = new google.maps.Geocoder(); var address = \'Santiago, Chile\' geocoder.geocode( { \'address\': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var latitude = results[0].geometry.location.lat(); var longitude = results[0].geometry.location.lng(); alert(\'La longitud es: \' + longitude + \', la latitud es: \' + latitude); }
Gracias