Created
January 6, 2020 21:45
-
-
Save softauthor/b77756fde8aa0c4bad23aa8923d51a5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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