You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I no longer use this module, and have not done so in a long while. If you use it, please consider taking over maintenance of this module (it's not a lot of work). Because of this situation, I have very limited time and expertise to answer any questions regarding this module
Go to the releases 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:
varL=require('leaflet');require('leaflet-routing-machine');require('lrm-graphhopper');// This will tack on the class to the L.Routing namespaceL.Routing.control({router: newL.Routing.GraphHopper('your GraphHopper API key'),}).addTo(map);
Note that you will need to pass a valid GraphHopper API key to the constructor.
To keep track of the GraphHopper credits consumption, the application may listen to the response event fired by the Router object. This event holds the values from GraphHopper's response HTTP headers: