How to use the mapbox.js.mapbox.accessToken function in mapbox

To help you get started, we’ve selected a few mapbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conveyal / taui / src / utils / mapbox-geocoder.js View on Github external
import lonlat from '@conveyal/lonlat'
import {mapbox} from 'mapbox.js'

mapbox.accessToken = process.env.MAPBOX_ACCESS_TOKEN

const MAPBOX_TYPES = ['address', 'neighborhood', 'place', 'poi']
const geocoder = mapbox.geocoder('mapbox.places')

export function search (apiKey, text, {
  boundary,
  focusLatlng,
  format
} = {}) {
  return geocode({boundary, focusLatlng, text})
    .then((results) => ({...results, features: results.features.slice(0, 3)}))
}

export function geocode ({
  boundary,
  focusLatlng,