Skip to content

Leaflet Routing Machine plugin with support for OSRM version 4

License

Notifications You must be signed in to change notification settings

perliedman/lrm-osrm4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet Routing Machine / OSRM 4

npm version

Extends Leaflet Routing Machine with support for OSRM's old major version, OSRM 4; Leaflet Routing Machine has built-in support for OSRM 5.

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

Installing

Go to the releases 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-osrm4

Using

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

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

L.Routing.control({
    router: L.routing.osrm4('http://your-osrm-url'),
}).addTo(map);

Note that you will need to set up your own OSRM4 server: OSRM's demo server is running OSRM 5.

About

Leaflet Routing Machine plugin with support for OSRM version 4

Resources

License

Stars

Watchers

Forks

Packages

No packages published