mapbox-gl-directions

Directions plugin for mapbox-gl-js using Mapbox Directions API.

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownermapbox/mapbox-gl-directions
Primary LanguageJavaScript
Program languageCSS (Language Count: 3)
Platform
License:ISC License
所有者活动
Created At2015-08-25 04:39:46
Pushed At2025-05-15 14:50:30
Last Commit At
Release Count24
Last Release Namev4.3.1 (Posted on )
First Release Namev0.0.0 (Posted on 2015-12-02 11:28:37)
用户参与
Stargazers Count247
Watchers Count118
Fork Count129
Commits Count392
Has Issues Enabled
Issues Count199
Issue Open Count92
Pull Requests Count81
Pull Requests Open Count21
Pull Requests Close Count22
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private