Extends Leaflet Routing Machine with support for Locationiq directions API.
Some brief instructions follow below, but the Leaflet Routing Machine tutorial on alternative routers is recommended.
npm install --save leaflet-routing-machine-locationiq
There's a single class exported by this module, L.Routing.Locationiq
. 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-locationiq'); // This will tack on the class to the L.Routing namespace
L.Routing.control({
router: new L.Routing.Locationiq('your api key'),
}).addTo(map);
Note that you will need to pass a valid Locationiq Api key to the constructor.
This is forked version based on OSRMv1 perliedman