Google Maps Autocomplete: how to get lat/lng?

There are methods called lat() and lng() that exist on the geometry object’s prototype. So to get the values, just use the following:

var place = autocomplete.getPlace();

var lat = place.geometry.location.lat(),
    lng = place.geometry.location.lng();

// Then do whatever you want with them

console.log(lat);
console.log(lng);

console.warn('Warning: I didn\'t test this code!');

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)