How to use the mapbox 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 department-of-veterans-affairs / vets-website / src / js / facility-locator / components / MapboxClient.js View on Github external
import MapboxClient from 'mapbox';

export const mapboxToken = 'pk.eyJ1IjoiYWRob2MiLCJhIjoiY2l2Y3VlNWp5MDBoNjJvbHZ2a3R4bnN2cyJ9.2LoUhwRmz2OiCtRirnc6Pw';
export const mapboxClient = new MapboxClient(mapboxToken);

export default mapboxClient;
github react-in-action / letters-social / src / components / map / LocationTypeAhead.js View on Github external
constructor(props) {
        super(props);
        this.state = {
            text: '',
            locations: [],
            selectedLocation: null,
            error: null
        };
        this.mapbox = new MapBox(process.env.MAPBOX_API_TOKEN);
        this.attemptGeoLocation = this.attemptGeoLocation.bind(this);
        this.handleLocationUpdate = this.handleLocationUpdate.bind(this);
        this.handleSearchChange = this.handleSearchChange.bind(this);
        this.handleSelectLocation = this.handleSelectLocation.bind(this);
        this.resetSearch = this.resetSearch.bind(this);
    }
    componentDidUpdate(prevProps, prevState) {
github LuncSAS / react-native-mapbox-direction / src / MapView.js View on Github external
componentDidMount() {
    MapboxGL.setAccessToken(this.props.mapBoxApiKey);
    this.mapboxClient = new MapboxClient(this.props.mapBoxApiKey);

    this.downloadRoute();
  }
github department-of-veterans-affairs / vets-website / src / applications / facility-locator / components / MapboxClient.js View on Github external
import { mapboxToken } from '../utils/mapboxToken';
import environments from '../../../platform/utilities/environment';

/**
 New: @mapbox/mapbox-sdk is initialized with the accessToken key as an object

 The conditional is for using the SDK version according to the environment ( New SDK in staging temporarily for QA)
 TODO: remove this logic after new sdk tested in staging

 MapboxClient1 : New SDK
 MapboxClient2 : Current SDK
*/
export const mapboxClient = environments.isStaging()
  ? new MapboxClient1({ accessToken: mapboxToken })
  : new MapboxClient2(mapboxToken);

export default mapboxClient;