forked from perliedman/lrm-graphhopper
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74431e1
commit c2bdd1f
Showing
8 changed files
with
57 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
Leaflet Routing Machine / GraphHopper | ||
===================================== | ||
Leaflet Routing Machine / TomTom | ||
================================ | ||
|
||
[![npm version](https://img.shields.io/npm/v/lrm-graphhopper.svg)](https://www.npmjs.com/package/lrm-graphhopper) | ||
|
||
Extends [Leaflet Routing Machine](https://github.com/perliedman/leaflet-routing-machine) with support for [GraphHopper](https://graphhopper.com/). | ||
Extends [Leaflet Routing Machine](https://github.com/perliedman/leaflet-routing-machine) with support for [TomTom](http://developer.tomtom.com/io-docs). | ||
|
||
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 | ||
|
||
Go to the [download page](http://www.liedman.net/lrm-graphhopper/download/) to get the script to include in your page. Put the script after Leaflet and Leaflet Routing Machine has been loaded. | ||
Install nodejs/iojs, clone this repository and execute: | ||
|
||
```sh | ||
npm install | ||
./scripts/dist.sh | ||
``` | ||
|
||
Put the script after Leaflet and Leaflet Routing Machine has been loaded. | ||
|
||
To use with for example Browserify: | ||
|
||
```sh | ||
npm install --save lrm-graphhopper | ||
npm install --save lrm-tomtom | ||
``` | ||
|
||
There's not pre-built files yet, but I will get to it. | ||
|
||
## Using | ||
|
||
There's a single class exported by this module, `L.Routing.GraphHopper`. 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: | ||
There's a single class exported by this module, `L.Routing.TomTom`. 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-graphhopper'); // This will tack on the class to the L.Routing namespace | ||
require('lrm-tomtom'); // This will tack on the class to the L.Routing namespace | ||
|
||
L.Routing.control({ | ||
router: new L.Routing.GraphHopper('your GraphHopper API key'), | ||
router: new L.Routing.TomTom('your TomTom API key'), | ||
}).addTo(map); | ||
``` | ||
|
||
Note that you will need to pass a valid GraphHopper API key to the constructor. | ||
Note that you will need to pass a valid TomTom API key to the constructor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters