using with other router
rakucmr opened this issue · 7 comments
How can be used with other router, especially with an offline router like graphhopper (www.graphhopper.com) or osm2po (www.osm2po.de)?
Right now it is pretty tightly coupled to the Open Source Routing Machine but we could write an adapter to support other formats. Can you provide me with a api key from graphhopper and I will happily take a look to evaluate?
You don't need an api key, take a look at here https://github.com/graphhopper/graphhopper, you can convert osm files to a graph format and graphhopper will route using that file.
Same think is happening also with osm2po - https://github.com/osm2po/snapp
I just looked at the output from your api
curl 'http://graphhopper.com/api/1/route?point=40.764771,-73.980764&point=40.670103,-73.985972&type=json&key=K1KVyGYve5choCJAbyejstj5Ho0dEa6RbBnwHbSw' --compressed | python -mjson.tool
and I think it should be pretty straight forward to write an adapter to support that output ... for the offline use should be pretty straight forward, although I'd have to familiarize myself with that usecase. How large is the data for the offline use? and do you limit per city/country?
depends, some mb in size, and coverage can be from city or country.
@Raku we'll use this opportunity to modularize the source to make it easy to write adapters for difference routers.
Thanks, this will be awesome!
Just had a conversation with @ecgreb about this issue - I'd love to see support for OpenTripPlanner as well. We're the developers of the OpenTripPlanner for Android app, and we have real-time nav on our roadmap. We'd love to use this library as part of our solution, and potentially contribute some improvements along the way. Major difference between OTP and other routers mentioned seems to be that OTP supports transit as a possible mode.
The OTP REST API is nearing a 1.0 release, which means its not set in stone (yet). However, the final version of the OTP REST API request/response should look very close to (if not the same as) this:
http://193.144.51.38:8080/otp/routers/default/plan?optimize=QUICK&showIntermediateStops=true&time=15:35&arriveBy=false&wheelchair=false&maxWalkDistance=1600.0&fromPlace=43.3455037%2C-8.4216164&toPlace=43.3640351%2C-8.4160384&date=10/21/14&mode=WALK,TRAM,SUBWAY,RAIL,BUS,FERRY,GONDOLA,FUNICULAR,TRAINISH
API docs for the current OTP server master branch are here:
http://docs.opentripplanner.org/apidoc/master/
If its helpful, the OTP Android client code for the REST API is mostly here (under Apache 2.0). In our OTP Android code you'll see some logic for supporting two formats for the REST API URL: an early beta, and pre-1.0 release (the above format). We use Jackson for the REST API request and deserializing JSON response. We also maintain a separate POJOs library for the OTP REST API, which is used with Jackson for data binding. Note that the POJOs library license is LGPL, which we inherit for that library only because the POJOs are derived from classes used in the main OTP project (which is also under LGPL). We isolate the POJOs in their own library (and make the artifacts available via Maven) to keep the OTP Android client purely under Apache 2.0. Please feel free to borrow any of this if it helps in the implementation of OTP support.