2011-09-01 18 views
6

Después de un tiempo, Google Maps parece cambiar el nombre de la propiedad (Qa o Pa) a Na u otro nombre.Error en latitud y longitud - Google Maps API JS 3.0

var map; 
function initialize() { 
    var myLatlng = new google.maps.LatLng(-25.363882,131.044922); 
    var myOptions = { 
    zoom: 4, 
    center: myLatlng, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    } 
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 

    google.maps.event.addListener(map, 'click', function(event) { 
    AlertPos(event.latLng); 
    }); 
} 

function AlertPos (location) { 

    // try to show the latitude and longitude 
    document.getElementById('lat').value = location.Qa; 
    document.getElementById('long').value = location.Pa; 
    alert(location.Qa) 
    alert(location.Pa) 
} 

Esto afecta mi aplicación. ¿Puede ayudar un cuerpo?

Respuesta

9

Uso lat() y lng():

function AlertPos (location) {   
    // try to show the latitude and longitude 
    document.getElementById('lat').value = location.lat(); 
    document.getElementById('long').value = location.lng(); 
    alert(location.lat()); 
    alert(location.lng()); 
} 
+0

Muchas gracias ... Trabajo;) – fmlvaz

+0

impresionante, no podía encontrar esto en la documentación! –

+0

Estaba perplejo por esto. Mi aplicación de mapas dejó de funcionar espontáneamente, ya que yo, como fmlvaz, confiaba en los valores 'Qa' y' Pa' (¡aunque antes eran 'Qa' y' Ra'!) –

Cuestiones relacionadas