Skip to content

mapbox/mapbox-gl-directions

Repository files navigation

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.

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'
});

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.

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 26