# leaflet-routing-machine-here

> Support for here in Leaflet Routing Machine, including route restrictions

Latest version **2.1.0** (published 2022-10-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install leaflet-routing-machine-here
pnpm add leaflet-routing-machine-here
yarn add leaflet-routing-machine-here
bun add leaflet-routing-machine-here
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2022-10-17 |
| First published | 2019-09-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 92.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jesse Crocker |
| Maintainers | daredzik |
| Keywords | leaflet, routing, route attributes, truck attributes, route restrictions, truck restrictions |

## Links

- npm: https://www.npmjs.com/package/leaflet-routing-machine-here
- Repository: https://github.com/Daredzik/lrm-here
- Issues: https://github.com/Daredzik/lrm-here/issues
- npm.io page: https://npm.io/package/leaflet-routing-machine-here

## Dependencies (5)

- [leaflet](https://npm.io/package/leaflet.md) ^1.8.0
- [corslite](https://npm.io/package/corslite.md) 0.0.7
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2
- [object-to-formdata](https://npm.io/package/object-to-formdata.md) 4.4.2
- [@liberty-rider/flexpolyline](https://npm.io/package/@liberty-rider/flexpolyline.md) 0.1.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2022-10-17
- 2.0.0 — 2022-06-07
- 1.6.1 — 2021-09-09
- 1.6.0 — 2020-09-11
- 1.5.0 — 2020-06-30
- 1.4.0 — 2019-10-01
- 1.3.2 — 2019-09-25
- 1.3.1 — 2019-09-16
- 1.2.0 — 2019-09-06
- 1.1.1 — 2019-09-05
- 1.1.0 — 2019-09-05
- 1.0.4 — 2019-09-02
- 1.0.3 — 2019-09-02
- 1.0.2 — 2019-09-02
- 1.0.1 — 2019-09-02
- … 1 more at https://npm.io/package/leaflet-routing-machine-here/versions

## README

Leaflet Routing Machine / HERE
=====================================

Extends [Leaflet Routing Machine](https://github.com/perliedman/leaflet-routing-machine) with support for [Here](https://developer.here.com/rest-apis/documentation/routing/topics/overview.html) routing API.

Some brief instructions follow below, but the [Leaflet Routing Machine tutorial on alternative routers](http://www.liedman.net/leaflet-routing-machine/tutorials/alternative-routers/) is recommended.

## Installing

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

## Using

There's a single class exported by this module, `L.Routing.Here`. It implements the [`IRouter`](http://www.liedman.net/leaflet-routing-machine/api/#irouter) interface. Use it to replace Leaflet Routing Machine's default OSRM router implementation:

```javascript
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.

## Options
| Property                | Type                         | Default      | Options |
| ------------------------| ---------------------------- | -------------| ------- |
| alternatives            | number                       | 0            | |
| noticesTypeAsRouteError | string['critical', 'info']   | ['critical'] | |
| routeRestriction        | object<RouteRestriction>     |              | |
| truckRestriction        | object<TruckRestriction>     |              | |
| urlParameters           | object<any>                  | {}           | [Available options](https://developer.here.com/documentation/routing-api/api-reference-swagger.html) |

## RouteRestriction `routeRestriction`

| Property      | Type    | Default | Options |
| ------        | -----   | ------- | ------- |
| avoidHighways | boolean | false   | |
| avoidTolls    | boolean | false   | |
| avoidFerries  | boolean | false   | |
| avoidDirtRoad | boolean | false   | |
| departureTime | string  | any     |  [Available options](https://developer.here.com/documentation/routing-api/api-reference-swagger.html) |
| transportMode | string  | car     |  [Available options](https://developer.here.com/documentation/routing-api/api-reference-swagger.html) |
| routingMode   | string  | fast    |  [Available options](https://developer.here.com/documentation/routing-api/api-reference-swagger.html) |

## TruckRestriction `truckRestriction`

| 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](https://developer.here.com/documentation/routing-api/api-reference-swagger.html)  | | | |
| trailerCount           | int       | count     | 0   | 4   |

This is forked version based on [trailbehind](https://github.com/trailbehind/lrm-Here)

---
_Source: https://npm.io/package/leaflet-routing-machine-here · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
