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 app id', 'your Here app code'),
}).addTo(map);
Note that you will need to pass a valid Here app code and app id to the constructor.
This is forked version based on trailbehind
Since the 1.1.0 version, you can calculate the route witch attributes of the route. To achieve this set generateMode: true
and fill options under routeRestriction
object using properties from below.
Since the 1.4.0 version, you can calculate the route with new attribute trafficMode
.
Property | Type | Default | Options |
---|---|---|---|
avoidHighways | boolean | ||
avoidTolls | boolean | ||
avoidFerries | boolean | ||
trafficMode | boolean | false | |
vehicleType | string | car | Available options |
routeType | string | fastest | Available options |
generateMode
is by default false
- Leaflet will calculate route using manually inserted mode (default fastest;car;
)
Since the 1.2.0 version, you can calculate the route witch attributes of the truck. To achieve this set routeRestriction.vehicleType: 'truck'
and fill options under truckRestriction
object using properties from below.
Since the 1.3.1 version, you can calculate the route with new attribute shippedHazardousGoods
.
Since the 1.5.0 version, you can calculate the route with new attributes enigneType
and trailersCount
.
Property | Type | HumanType | Min | Max |
---|---|---|---|---|
height | int | meters | 0 | 50 |
width | int | meters | 0 | 50 |
length | int | meters | 0 | 300 |
limitedWeight | int | tons | 0 | 1000 |
weightPerAxle | int | tons | 0 | 1000 |
shippedHazardousGoods | array Available options | |||
engineType | string Available options | |||
trailersCount | int | count | 0 | 4 |
Property will not be added if its value is empty (''
or null
or []
).
When TruckRestrictions are enabled, property truckType
(read-only) will automatically added to request witch value 'truck'
.