Created
January 25, 2017 22:42
-
-
Save sunnygleason/9a3a90d21706ba3bdc5061449c20844a to your computer and use it in GitHub Desktop.
PubNub Mapping w/ Mapbox BLOCK
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
export default request => { | |
let xhr = require('xhr'); | |
let query = require('codec/query_string'); | |
let clientToken = 'YOUR_CLIENT_TOKEN'; | |
let apiUrl = 'https://api.mapbox.com/styles/v1/mapbox/streets-v8/static'; | |
let zoom = request.message.zoom; | |
let resolution = '300x200'; | |
let lat = request.message.lat; | |
let lng = request.message.lng; | |
let queryParams = { | |
access_token: clientToken, | |
}; | |
apiUrl += '/' + lng + ',' + lat + ',' + zoom + '/' + resolution; | |
let url = apiUrl + '?' + query.stringify(queryParams); | |
request.message.map = url; | |
return request.ok() | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment