Extends Leaflet Routing Machine with support for Here routing API.
Some brief instructions follow below, but the Leaflet Routing Machine tutorial on alternative routers is recommended.
npm install --save leaflet-routing-machine-here
There's a single class exported by this module, L.Routing.Here
. 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-here'); // This will tack on the class to the L.Routing namespace
L.Routing.control({
router: new L.Routing.Here('your Here api key', {
routeRestriction: {
transportMode: 'truck'
},
truckRestriction: {
height: 300
},
urlParameters: {
avoid: {
tollTransponders: 'all'
}
}
}),
}).addTo(map);
Note that you will need to pass a valid Here apiKey to the constructor.
Property | Type | Default | Options |
---|---|---|---|
alternatives | number | 0 | |
noticesTypeAsRouteError | string['critical', 'info'] | ['critical'] | |
routeRestriction | object | ||
truckRestriction | object | ||
urlParameters | object | {} | Available options |
Property | Type | Default | Options |
---|---|---|---|
avoidHighways | boolean | false | |
avoidTolls | boolean | false | |
avoidFerries | boolean | false | |
avoidDirtRoad | boolean | false | |
trafficMode | boolean | false | |
transportMode | string | car | Available options |
routingMode | string | fast | Available options |
Property | Type | HumanType | Min | Max |
---|---|---|---|---|
height | int | centimeters | 0 | - |
width | int | centimeters | 0 | - |
length | int | centimeters | 0 | - |
grossWeight | int | kilograms | 0 | - |
weightPerAxle | int | kilograms | 0 | - |
shippedHazardousGoods | array Available options | |||
trailerCount | int | count | 0 | 4 |
This is forked version based on trailbehind