Last active
December 18, 2018 03:43
-
-
Save drecodeam/e92cd619af3dc3f103617ef46607fe72 to your computer and use it in GitHub Desktop.
This file contains 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
mapbox_api_endpoint = 'https://api.mapbox.com/geocoding/v5/' | |
# Using this service to bypass CORS related issue | |
bypass_cors = 'https://cors-anywhere.herokuapp.com/' | |
# Update the place name | |
getPlaceName = ( coordinates ) -> | |
geocodeRequestUrl = bypass_cors + mapbox_api_endpoint + "mapbox.places/" + coordinates[1] + "," + coordinates[0] + ".json?&access_token=" + access_token | |
fetch(geocodeRequestUrl).then( (result) -> | |
result.json() | |
).then( ( data ) -> | |
return data.features[0] | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment