robert-ngo / lrm-Here

Support for Here routing API in Leaflet Routing Machine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leaflet Routing Machine / HERE

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.

Installing

npm install --save leaflet-routing-machine-here

Using

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

RouteRestriction routeRestriction

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

WARNING

generateMode is by default false - Leaflet will calculate route using manually inserted mode (default fastest;car;)

TruckRestriction truckRestriction

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.

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

WARNING

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'.

About

Support for Here routing API in Leaflet Routing Machine

License:ISC License


Languages

Language:JavaScript 96.8%Language:Shell 3.2%