OTP - OpenTripPlanner

What is OTP?

OpenTripPlanner (OTP) is an open-source multi-modal trip planner.

Let's break this down for clarity:

  • an open-source...

Open source is a model of software development that encourages collaboration, by making the code freely available for use, modification, and redistribution.

OpenTripPlanner follows this model. Its codebase is publicly available on GitHub, and it's documented on docs.opentripplanner.org to help you get started.

  • ...multi-modal...

This literally means "using multiple modes" which, in the case of mobility, represents transport modes.

OpenTripPlanner supports them all (at city level), i.e.:

  • walking
  • the user's own bicycle
  • the user's own car
  • public transportation (buses, trams, trains... refer to GTFS' supported "route_type" values* for the full list)
  • and shared vehicles (including scooters, bicycles, cars, vans, etc.).

* Note that there's a proposal to extend GTFS route types which, among other things, introduces a new air service. If this is available to OpenTripPlanner, it will support it as an "airplane" mode.

  • ...trip planner

A trip planner (also known as a route, journey, or itinerary planner) is a type of search engine that enables finding the optimal travel path between a start and end location. It may or may not allow extra parameters to generate the user's ideal itinerary.

OpenTripPlanner is a rather powerful planner that supports:

  • using a specific start or end date
  • choosing one or more allowed transportation modes
  • optimising on preferred criteria (e.g. the fastest or cheapest route)
  • customising the response (e.g. displaying or not the intermediate stops)
  • applying user-defined algorithm variations (e.g. max walk time, tolerance to wait time)
  • taking into account realtime updates on the public transportation network

...and many more features.

How does it work?

There are two components to the OpenTripPlanner software:

  1. a backend responsible for planning the itineraries
  2. a frontend in the form of a map and user-friendly form to request itineraries.

The backend

At its core, OTP is first and foremost a server-side Java application in two parts:

The first is a graph builder that creates a representation of a mobility network, called a graph, using the following data sources:

  • OpenStreetMap (OSM) to map the streets' infrastructure (i.e. streets, sidewalks, bicycle lanes, etc.)
  • one or more GTFS feeds to map the transit network (i.e. public transportation routes, schedules, shared vehicle stations, etc.).

So basically OpenStreetMap draws a city, region, country or other area. Then GTFS is attached to this representation of the real world using data like stops' coordinates.

The second component of the backend is a server that exposes API endpoints for optimal trip calculation, based on the previously built graph plus user-provided parameters.

The frontend

Frontend is secondary to OTP. The software is developed with the assumption that developers will connect their own frontend to the API, so its own doesn't get that much attention. Nonetheless, OpenTripPlann offers a web-based JavaScript user interface that:

  • provides a form to pass the user's preferred trip details
  • makes requests to the backend API* to produce trip plans
  • displays the results, i.e. the trips and their details, on a map.

* The API requests and responses are visible in the browser's console. This is useful for debugging.

Support

There's very little chatter on OpenTripPlanner news and issues on the usual support channels (such as StackOverflow and Reddit). If the documentation has you lost, the best way to get help is to ask for it on the project's official chat room.

This chat room is great to get a quick answer from experts, but it's really bad for search. I wish the team would create a Q&A site. Until they do, I encourage you to post (a copy of) your question, and its answer, on a search-engine-indexed page like Reddit, so those that follow you might benefit from it too <3