Skip to content

StartupMakers/lrm-graphhopper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet Routing Machine / GraphHopper

npm version

Extends Leaflet Routing Machine with support for GraphHopper.

Some brief instructions follow below, but the Leaflet Routing Machine tutorial on alternative routers is recommended.

Installing

Go to the download page to get the script to include in your page. Put the script after Leaflet and Leaflet Routing Machine has been loaded.

To use with for example Browserify:

npm install --save lrm-graphhopper

Using

There's a single class exported by this module, L.Routing.GraphHopper. 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-graphhopper'); // This will tack on the class to the L.Routing namespace

L.Routing.control({
    router: new L.Routing.GraphHopper('your GraphHopper API key'),
}).addTo(map);

Note that you will need to pass a valid GraphHopper API key to the constructor.

About

Support for GraphHopper in Leaflet Routing Machine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 84.7%
  • Shell 15.3%