Skip to content

Instantly share code, notes, and snippets.

@softauthor
Created January 6, 2020 21:45
Show Gist options
  • Save softauthor/b77756fde8aa0c4bad23aa8923d51a5e to your computer and use it in GitHub Desktop.
Save softauthor/b77756fde8aa0c4bad23aa8923d51a5e to your computer and use it in GitHub Desktop.
async getStreetAddressFrom(lat, long) {
try {
var { data } = await axios.get(
"https://maps.googleapis.com/maps/api/geocode/json?latlng=" +
lat +
"," +
long +
"&key={yourAPIKey}"
);
if(data.error_message) {
console.log(data.error_message)
} else {
this.address = data.results[0].formatted_address;
}
} catch (error) {
console.log(error.message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment