bliksemlabs / rrrr

RRRR rapid real-time routing
BSD 2-Clause "Simplified" License
167 stars 32 forks source link

[question] How does one use rrrr #118

Open bambax opened 10 years ago

bambax commented 10 years ago

How does one query rrrr? I have it running with some GTFS data, but can't seem to figure out how to query it (sorry!)

Is it possible to query it via HTTP / does it need a webserver in front of it...?

Is there a doc for the API?

Thank you.

skinkie commented 10 years ago

After you compile the code the commandline tool testerrrr can be used to test the journey planner itself. ./testerrrr -r makes a random request. The "webbased" API is compatible with OpenTripPlanner. Using "cherokee" in our repository in the handler_rrrr branch you will be able to start it.

We don't have any installation guidelines yet, but they will be available shortly.

bambax commented 10 years ago

Okay yes ./testerrrr -r works and makes requests, although it's hard to distinguish the query from the response.

Monitoring ports 9292|9293 with tcpdump -A shows a bunch of JSON objects being passed around, but again, it's unclear what's what.

Trying to use ./testerrrr --from-idx <stop_id> --to-idx <stop_id> with <stop_id> coming directly from the column of the same name in output.gtfsdb in the stops table, only results in the response "Dude, you are already there"... but obviously I'm not! ;-) (I also tried stop_name, to no avail).

(Also, testerrrr apparently tests every transfer for symetry (all >200 millions of them) on every run, which makes it a little slow to use).

If I could use testrrrr by sending it two stop ids and getting a readable JSON response, it would be enough for testing purposes; if I could then do the same via http I would be very happy... ;-)

Thanks.

skinkie commented 10 years ago

If you want I can help you setting up cherokee with bliksem, like it is on https://1313.nl/ Just send an e-mail ;)

wjanssen commented 10 years ago

@bambax:

Start the program otp_api. It will listen on port 9393. Then use "curl" to send it a request. For instance, using the Netherlands DB referenced in README.md,

$ curl 'http://127.0.0.1:9393/?to-idx=54864&from-idx=29164'

which should return a JSON representation of the trip plan. Look in parse.c/parse_request_from_qstring for the various attributes you can send in the HTTP request.