Skip to content

Instantly share code, notes, and snippets.

@sir4ju1
Last active August 29, 2015 13:59
Show Gist options
  • Save sir4ju1/10921467 to your computer and use it in GitHub Desktop.
Save sir4ju1/10921467 to your computer and use it in GitHub Desktop.
get location name using reverse geocoding by lattitude and longitude
var latlng = '40.714224,-73.961452';
var url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='+latlng+'&sensor=false';
$.get(url, function(result, response) {
if(result.status === 'OK' && result.results.length > 0) {
var res = result.results[0];
console.log(res.formatted_address);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment