Skip to content

Instantly share code, notes, and snippets.

@sunnygleason
Created January 25, 2017 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunnygleason/9a3a90d21706ba3bdc5061449c20844a to your computer and use it in GitHub Desktop.
Save sunnygleason/9a3a90d21706ba3bdc5061449c20844a to your computer and use it in GitHub Desktop.
PubNub Mapping w/ Mapbox BLOCK
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