Home

Awesome

Leaflet Routing Machine / TomTom

Extends Leaflet Routing Machine with support for TomTom.

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

Installing

Install nodejs/iojs, clone this repository and execute:

npm install
./scripts/dist.sh

Put the script after Leaflet and Leaflet Routing Machine has been loaded.

To use with for example Browserify:

npm install --save lrm-tomtom

Using

There's a single class exported by this module, L.Routing.TomTom. 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-tomtom'); // This will tack on the class to the L.Routing namespace

L.Routing.control({
    router: new L.Routing.TomTom('your TomTom API key', options),
}).addTo(map);

Note that you will need to pass a valid TomTom API key to the constructor.

Options

Some of the available options from TomTom Online Routing are supported:

See TomTom Online Routing Documentation for further informations.