Routing API enables developers to query routes and timetable related information using either REST or GraphQL interfaces.
edit architecture imageRouting API is implemented using OpenTripPlanner.
OpenTripPlanner APIs provide access to static and realtime routing and transit information. Routing and timetable data is based on static GTFS and it is enriched by realtime information for those departures that have realtime information available. This means that results returned by OpenTripPlanner always contain realtime information should it be available.
If you need to make large amount of requests (e.g. requesting schedules from all stops) to the API, you might want to host the API locally. To run OpenTripPlanner with Docker, use command:
docker run --rm --name otp-hsl -p 9080:8080 -e ROUTER_NAME=hsl -e JAVA_OPTS=-Xmx5g -e ROUTER_DATA_CONTAINER_URL=https://api.opentransport.ro/routing-data/v2/hsl opentransport/opentripplanner
After OpenTripPlanner has built the routing graph, the API can be accessed from http://localhost:9080/otp/routers/hsl/index/graphql
REST interface is provided as it is available in OpenTripPlanner. First thing to do is to familiarize yourself with OpenTripPlanner documentation:
OpenTripPlanner requires developers to make API requests through routers. OpenTransport providers routers for Timisoara region and entire Romania:
Region | Router URL |
---|---|
Timisoara region | http://api.opentransport.ro/routing/v1/routers/timisoara/ |
Entire Romania | http://api.opentransport.ro/routing/v1/routers/romania/ |
GraphQL API is built by us. Similarly to REST, GraphQL has different router endpoints for Timisoara region and entire Romania.
For more details about the GraphQL you can go to our GraphQL page
You can get access to GraphQL schema by running this example in GraphQL console
URL | Project description |
---|---|
https://github.com/opentripplanner/OpenTripPlanner | OpenTripPlanner upstream development on GitHub |
https://groups.google.com/forum/#!forum/opentripplanner-dev | OpenTripPlanner forum for developers |
https://groups.google.com/forum/#!forum/opentripplanner-users | OpenTripPlanner forum for end users |
https://onebusaway.org/ | OneBusAway: The Open Source platform for Real Time Transit Info |
https://github.com/OneBusAway?utf8=✓&query=gtfs | GTFS related projects: Open-source transit app for real-time information |
https://developers.google.com/transit/ | Google developers transit community: Making public transit data universally accessible |
https://github.com/conveyal/r5 | Conveyal R5 development on GitHub: Rapid Realistic Routing on Real-world and Reimagined networks |
https://blog.conveyal.com/ | Conveyal blog |
The resulting Docker image is called opentransport/opentripplanner and it is available at DockerHub. The image can be built using this build script. You might also want to take a look at the Travis build and configuration.
To run Docker container, run:
docker run -e OTP_DATA_CONTAINER_URL=http://otp-data-container:8080 -p 8080:8080 opentransport/opentripplanner
To access Docker container:
http://localhost:8080/routers/
For More information about how to use Docker see docker info.