项目作者: mapbox

项目描述 :
Directions plugin for mapbox-gl-js using Mapbox Directions API.
高级语言: JavaScript
项目地址: git://github.com/mapbox/mapbox-gl-directions.git
创建时间: 2015-08-25T04:39:46Z
项目社区:https://github.com/mapbox/mapbox-gl-directions

开源协议:ISC License

下载


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

  1. var mapboxgl = require('mapbox-gl');
  2. var MapboxDirections = require('@mapbox/mapbox-gl-directions');
  3. var directions = new MapboxDirections({
  4. accessToken: 'YOUR-MAPBOX-ACCESS-TOKEN',
  5. unit: 'metric',
  6. profile: 'mapbox/cycling'
  7. });
  8. var map = new mapboxgl.Map({
  9. container: 'map'
  10. });
  11. 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.