correct mapbox token default

This commit is contained in:
Lachlan Kermode
2019-05-15 14:52:17 +01:00
parent 23ceaa2959
commit 10e3100426
2 changed files with 6 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ module.exports = {
SITES_EXT: '/api/example/export_sites/rows',
SHAPES_EXT: '/api/example/export_shapes/columns',
INCOMING_DATETIME_FORMAT: '%m/%d/%YT%H:%M',
MAPBOX_TOKEN: 'pk.EXAMPLE_MAPBOX_TOKEN',
// MAPBOX_TOKEN: 'pk.EXAMPLE_MAPBOX_TOKEN',
features: {
USE_COVER: false,
USE_TAGS: false,

View File

@@ -17,7 +17,6 @@ import DefsMarkers from './presentational/Map/DefsMarkers.jsx'
// NB: important constants for map, TODO: make statics
const supportedMapboxMap = ['streets', 'satellite']
const defaultToken = 'your_token'
class Map extends React.Component {
constructor () {
@@ -70,14 +69,17 @@ class Map extends React.Component {
let firstLayer
if ((supportedMapboxMap.indexOf(this.props.ui.tiles) !== -1) && process.env.MAPBOX_TOKEN && process.env.MAPBOX_TOKEN !== defaultToken) {
// if mapbox token and one of the default maps are specified
if ((supportedMapboxMap.indexOf(this.props.ui.tiles) !== -1) && process.env.MAPBOX_TOKEN) {
firstLayer = L.tileLayer(
`http://a.tiles.mapbox.com/v4/mapbox.${this.props.ui.tiles}/{z}/{x}/{y}@2x.png?access_token=${process.env.MAPBOX_TOKEN}`
)
} else if (process.env.MAPBOX_TOKEN && process.env.MAPBOX_TOKEN !== defaultToken) {
// if mapbox token and custom map
} else if (process.env.MAPBOX_TOKEN) {
firstLayer = L.tileLayer(
`http://a.tiles.mapbox.com/styles/v1/${this.props.ui.tiles}/tiles/{z}/{x}/{y}?access_token=${process.env.MAPBOX_TOKEN}`
)
// no mapbox token
} else {
firstLayer = L.tileLayer(
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'