Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
/ lrm-mapbox Public archive

DEPRECATED. Support for Mapbox directions API v4 in Leaflet Routing Machine

License

Notifications You must be signed in to change notification settings

perliedman/lrm-mapbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet Routing Machine / Mapbox

DEPRECATED Leaflet Routing Machine v3.1.0 and up natively supports Mapbox Directions by using the builtin class L.Routing.Mapbox. If you for some reason need support for Mapbox directions v4, you can still use this plugin.

npm version

Extends Leaflet Routing Machine with support for Mapbox's directions API.

See the lrm-mapbox demo

Some brief instructions follow below, but the Leaflet Routing Machine tutorial on alternative routers is recommended.

Installing

Go to the download page to get the script to include in your page. Put the script after Leaflet and Leaflet Routing Machine has been loaded.

To use with for example Browserify:

npm install --save lrm-mapbox

Using

There's a single class exported by this module, L.Routing.Mapbox. It implements the IRouter interface. Use it to replace Leaflet Routing Machine's default OSRM router implementation:

var L = require('leaflet');
require('leaflet-routing-machine');
require('lrm-mapbox'); // This will tack on the class to the L.Routing namespace

L.Routing.control({
    router: new L.Routing.Mapbox('your mapbox access token'),
}).addTo(map);

Note that you will need to pass a valid Mapbox access token to the constructor.

About

DEPRECATED. Support for Mapbox directions API v4 in Leaflet Routing Machine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •