Skip to content

Commit

Permalink
Add Mapbox map provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcojrfurtado committed Feb 8, 2020
1 parent 06f0d74 commit 3349f44
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/components/ZonesMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ const styles = theme => ({
}
});

const MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoibWFyY29qcmZ1cnRhZG8iLCJhIjoiY2s2ZHlzamIxMXNqdjNncWozOTJmdzZzZSJ9.yrrQycmV2A8bSe6ZyyfEug'
const mapbox = (mapboxId, accessToken) => (x, y, z, dpr) => {
return `https://api.mapbox.com/styles/v1/mapbox/${mapboxId}/tiles/256/${z}/${x}/${y}${dpr >= 2 ? '@2x' : ''}?access_token=${accessToken}`
}

const providers = {
streets: mapbox('streets-v10', MAPBOX_ACCESS_TOKEN)
}

class ZonesMap extends Component {

constructor(props) {
Expand Down Expand Up @@ -70,6 +79,7 @@ class ZonesMap extends Component {
<Grid container direction="row" spacing={2}>
<Grid item className={classes.mapContainer}>
<Map
provider={providers['streets']}
center={cityOfWaterlooCoordinates}
zoom={13}>
{
Expand Down

0 comments on commit 3349f44

Please sign in to comment.