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.
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);
1.4m articles
1.4m replys
5 comments
57.0k users