Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for GraphHopper in Leaflet Routing Machine

License

NotificationsYou must be signed in to change notification settings

perliedman/lrm-graphhopper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maintainers Wanted

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

npm version

ExtendsLeaflet Routing Machine with support forGraphHopper.

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

Installing

Go to thereleases 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 theIRouter 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 theresponse event fired by the Router object. This event holds the values fromGraphHopper's response HTTP headers:

  • status: The HTTP status code (seeGraphHopper error codes)
  • limit: TheX-RateLimit-Limit header
  • remaining: TheX-RateLimit-Remaining header
  • reset: TheX-RateLimit-Reset header
  • credits: TheX-RateLimit-Credits header
varrouter=myRoutingControl.getRouter();router.on('response',function(e){console.log('This routing request consumed '+e.credits+' credit(s)');console.log('You have '+e.remaining+' left');});

About

Support for GraphHopper in Leaflet Routing Machine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors10


[8]ページ先頭

©2009-2025 Movatter.jp