Is it possible to get an address from coordinates using google maps?

google-maps, google-maps-api-3

Solution

yes. Just use Google Geocoding and Places API https://developers.google.com/maps/documentation/geocoding/ and https://developers.google.com/maps/documentation/places/

Example (derived from here):

var geocoder;

function initialize() {
  geocoder = new google.maps.Geocoder();
}

function codeLatLng(lat, lng) {
  var latlng = new google.maps.LatLng(lat, lng);
  geocoder.geocode({
    'latLng': latlng
  }, function (results, status) {
    if (status === google.maps.GeocoderStatus.OK) {
      if (results[1]) {
        console.log(results[1]);
      } else {
        alert('No results found');
      }
    } else {
      alert('Geocoder failed due to: ' + status);
    }
  });
}

google.maps.event.addDomListener(window, 'load', initialize);

Problem

I'm just curious. Maybe for a future project. I want to know if it's possible to retrieve an address from a giving coordinate via the Google API.

Original source