@mapbox/mapbox-gl-directions

    4.1.0 • Public • Published

    Mapbox GL Directions

    A full featured directions plugin for Mapbox GL JS using the Mapbox Directions API. Quickly add UI to display driving, cycling, or walking directions on the map. The Mapbox Directions API is powered by the OSRM routing engine and open data from the OpenStreetMap project.

    For directions functionality in native mobile and desktop applications, see Mapbox Android Services, MapboxDirections.swift, and MapboxNavigation.swift.

    Usage

    var mapboxgl = require('mapbox-gl');
    var MapboxDirections = require('@mapbox/mapbox-gl-directions');
     
    var directions = new MapboxDirections({
      accessToken: 'YOUR-MAPBOX-ACCESS-TOKEN',
      unit: 'metric',
      profile: 'mapbox/cycling'
    });
     
    var map = new mapboxgl.Map({
      container: 'map',
      style: 'mapbox://styles/mapbox/streets-v9'
    });
     
    map.addControl(directions, 'top-left');

    Live example: https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-directions/

    Deeper dive

    See API.md for complete reference.

    Contributing

    See CONTRIBUTING.md.

    Install

    npm i @mapbox/mapbox-gl-directions

    DownloadsWeekly Downloads

    2,081

    Version

    4.1.0

    License

    ISC

    Unpacked Size

    418 kB

    Total Files

    47

    Last publish

    Collaborators

    • mapbox-admin
    • mapbox-machine-user
    • mapbox-npm
    • mapbox-npm-01
    • mapbox-npm-02
    • mapbox-npm-03
    • mapbox-npm-04
    • mapbox-npm-05
    • mapbox-npm-06
    • mapbox-npm-07
    • mapbox-npm-08
    • mapbox-npm-09
    • mapbox-npm-advanced-actions
    • mapbox-npm-ci