Skip to content

Instantly share code, notes, and snippets.

@iamcanadian1973
Created May 8, 2020 17:12
Show Gist options
  • Save iamcanadian1973/496d1a34610b16a0624239e0568f29f2 to your computer and use it in GitHub Desktop.
Save iamcanadian1973/496d1a34610b16a0624239e0568f29f2 to your computer and use it in GitHub Desktop.
GEO Code address
var geocoder = new google.maps.Geocoder();
var address = '90001';
geocoder.geocode({'address': address}, function(results, status) {
if (status === 'OK') {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
console.log(latitude + ',' + longitude);
} else {
console.log('Geocode was not successful for the following reason: ' + status);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment