From OpenStreetMap Wiki
(Redirected from OTP)
Jump to navigation Jump to search
OpenTripPlanner screenshot.png
License: GNU Lesser General Public License v3 (free of charge)
Platforms: Windows, Linux, and macOS
Source code: Blacktocat.svg opentripplanner/OpenTripPlanner
Programming language: Java

Pedestrian and public transport routing engine

OpenTripPlanner (OTP) [1] is a collaborative effort among TriMet [2] (the public transportation agency serving Portland, OR, USA), OpenPlans [3], and the developers of Five Points [4], OneBusAway [5], and Graphserver [6], as well as several independent developers, to develop an open-source multimodal trip planning software system.


  • Designed to use open data sources OpenStreetMap and the General Transit Feed Specification (GTFS) [7]
  • Allows users to plan a trip that can combine multiple modes of transportation, such as bicycling or walking to reach public transportation
  • Interlines (transfers) between different public transportation systems
  • User can specify departure or arrival times for public transportation
  • Optional routing criteria
    • Quickest trip
    • Fewest transfers
    • A "bicycle preference triangle" that allows users to adjust between quickest, flattest, and bike-friendly routes
    • Can incorporate several popular bike-sharing systems
    • Wheelchair accessibility
    • Maximum walking distance to public transportation
  • Point-and-click or geocoder to set origin and destination
  • Permalinks available for generated routes
  • Routing across plazas/piazzas open pedestrian areas (highway=pedestrian, area=yes)
  • Support for planning travel that combines transit and bike-sharing services
  • Deployable as a multimodal trip planning website that can be offered via industry-standard Web browsers. There are several working demo instances [8] of OpenTripPlanner.


OpenTripPlanner relies on General Transit Feed Specification (GTFS) data to describe public transportation schedules and routes. It can use OpenStreetMap (or commercial data sources) for data on sidewalks, bicycling infrastructure, and streets. The two sources of data are linked through transit stops, which are parts of both sets of data. OpenTripPlanner also can link to the US National Elevation Dataset (NED) data [9] and provide an elevation graph for bicycle trips. Compatibility with similar elevation datasets for other countries is uncertain.

Detailed descriptions of the different types of data that OpenTripPlanner can use to build a network for routing, or graph, are available on the OpenTripPlanner configuration page.

There are also efforts underway to integrate real-time transit data for estimated arrival times into OTP transit routing, based on research by a UC Berkeley team which has also created the BayTripper ( mobile transit application (Jariyasunant, J. et al. “Mobile Transit Trip Planning with Real-time Data,” Proceedings of the US National Academy of Sciences’ Transportation Research Board, 90th Annual Meeting, January 2011)


The core of OpenTripPlanner consists of three basic software components: a graph builder, a routing engine, and a user interface. While the primary user interface (i.e., map and visual representation of route) is written in JavaScript, the other components are written in the Java programming language on the Java Enterprise Edition (Java EE) platform. The OpenTripPlanner routing engine is integrated into a RESTful web service API that can be used with other custom client applications.

The most recent progress on the OpenTripPlanner project can be found at the OpenTripPlanner Developers Group [10], OpenTripPlanner Users Group [11], and Transit Developers Group [12] mailing lists, as well as the main OpenTripPlanner website [13].

The OpenTripPlanner source code is licensed under the GNU Lesser General Public License (LGPL) [14] and is publicly available on the website.


OpenTripPlanner employs two different methods for routing: the A* algorithm and Contraction Hierarchies. Originally, OpenTripPlanner used only plain Dijkstra's algorithm and A* with a Euclidian distrance metric to route trips for all modes of transportation. Those algorithms performed very slowly on large graphs. Recent research has shown a new technique, Contraction Hierarchies [15], to perform better on large graphs. The idea behind Contraction Hierarchies is that a large graph can be contracted by removing vertices one at a time and replacing any paths through the removed vertex with a shortcut representing that path. As the OpenTripPlanner community implemented this functionality, it became apparent that transit routing would be difficult with this new approach as the nodes for transit were time-dependent. Their solution was to use core-based routing which means that only non-transit segments of routing would receive the benefit of faster performance with Contraction Hierarchies. Additional routing performance improvements in OpenTripPlanner have included implementing improved A* heuristics for transit routing (inspired by [16]).

Routing visualization

You can visualize the OTP route graph if you, for example, want to improve OSM data for routing or if you want to do routing related software development.

Assuming that you have cloned the OTP Github repository and built it (see Building OTP from source) do the following steps:

  1. Get the up-to-date OSM data extract for the area you are interested in either in PBF or XML format. The size of the extract area affects how long the graph building takes. Note that the GTFS-file (see the next step) has to be in the same directory. The file should be recognized by the OTP no matter how you name it.
  2. Get the up-to-date GTFS file for the area you are interested in. GTFS wiki page lists some possible options for finding the file. Place the file in the the same directory where you placed the osm extract file.

After getting the data run the following commands:

cd path_to_your_OTP_github_clone_dir
java -Xmx4G -jar target/otp-1.1.0-SNAPSHOT-shaded.jar --build path_to_your_data_dir --inMemory --visualize

Consider increasing the used maximum memory (-Xmx parameter) if your system has more memory as the graph building does consume memory.

Wait that the graph building finishes and there is message "[HttpServer] Started". You probably see warnings but they do not prevent the graph building. You can now open your web browser and go the page http://localhost:8080/?debug_layers=true.

As a result you should see the routing graph and be also able to choose the visualized layer. See the OTP Troubleshooting Routing Page for some info on the graph.

Whenever you update your GTFS or OSM data, replace the old files and repeat the commands above.


There are several working demos and production instances of OpenTripPlanner. TriMet currently uses OpenTripPlanner for its map trip planner [17], which was made possible by a project (RLIS) to improve the OpenStreetMap data in the Portland, OR, USA area. Researchers at the University of South Florida’s Center for Urban Transportation Research in Tampa, FL, USA have set up a demonstration instance [18] and have proposed a trip planning system for the University campus that, if implemented, will use OpenTripPlanner and data from OpenStreetMap. OpenPlans is discussing deployment with organizations in several US and international cities and regions, as of early June, 2011. [19] has information on hosted OpenTripPlanner solutions.

Instructions for downloading and creating your own OpenTripPlanner website deployment can be found on the OpenTripPlanner setup instructions page.

More detail on OpenTripPlanner, and discussion of the software and its use, can also be found in a recent research report from the University of South Florida [20]

Mobile Apps

OpenTripPlanner for Android [21] - An Android app for multi-modal trip planning and navigation using any OpenTripPlanner server

How OpenTripPlanner uses OSM tags for routing

Basic Permissions

Access tags (such as bicycle/foot = yes/no/designated) can be used to override default graph-building parameters.

As a default, foot and bicycle traffic is not allowed on highway=trunk, highway=trunk_link, highway=motorway, highway=motorway_link, or highway=construction.

Both are allowed on highway=pedestrian, highway=cycleway, and highway=footway.

Finally, bicycles are not allowed on highway=footway when any of the following tags appear on a footway: footway=sidewalk, public_transport=platform, or railway=platform.

Other access tags (such as access=no and access=private affect routing as well, and can be overridden similarly. While access=no prohibits all traffic, access=private disallows through traffic.

Bicycle routing

In general, weights are applied to the following tags for "bike friendly"/"safest" bicycle routing (as of 10/11/12). Weights act as multipliers, so ways with values of less than 1 appear shorter to the router, while those with values of greater than 1 appear longer.

Basic situations

Highway tag Weight
highway=cycleway 0.60
highway=path 0.75
highway=pedestrian 0.90
highway=footway 1.1
highway=footway with footway=crossing 2.5
highway=bridleway 1.3
highway=living_street 0.90
highway=unclassified 1
highway=road 1
highway=byway 1.3
highway=track 1.3
highway=service 1.1
highway=residential or highway=residential_link 0.98
highway=tertiary or highway=tertiary_link 1
highway=secondary or highway=secondary_link 1.5
highway=primary or highway=primary_link 2.06
highway=trunk_link or highway=motorway_link 2.06
highway=trunk 7.47
highway=motorway 8

Designated bike route (bicycle=designated)

Highway tag Weight
highway=** (default) 0.97
highway=path 0.60
highway=footway 0.75
highway=footway with footway=sidewalk 1.1
highway=footway with footway=sidewalk and bicycle=yes instead of bicycle=designated 2.5
highway=footway with footway=crossing 1.1
highway=service 0.84
highway=residential or highway=residential_link 0.95
highway=tertiary or highway=tertiary_link 0.97
highway=secondary or highway=secondary_link 1.46
highway=primary or highway=primary_link 2
highway=trunk_link or highway=motorway_link 2
highway=trunk 7.25
highway=motorway 7.76

Bike lanes (cycleway=lane)

Highway tag Weight
highway=** (default) 0.87
highway=service 0.77
highway=residential or highway=residential_link 0.77
highway=tertiary or highway=tertiary_link 0.87
highway=secondary or highway=secondary_link 0.96
highway=primary or highway=primary_link 1.15
highway=trunk_link or highway=motorway_link 1.15
highway=trunk 1.5
highway=motorway 2

Cycle tracks (cycleway=track)

Highway tag Weight
highway=** (default) 0.73
highway=service 0.70
highway=residential or highway=residential_link 0.70
highway=tertiary or highway=tertiary_link 0.75
highway=secondary or highway=secondary_link 0.80
highway=primary or highway=primary_link 0.85
highway=trunk_link 0.85
highway=trunk 0.9

Shared bike/vehicle lanes (marked with sharrows) (cycleway=shared_lane)

Highway tag Weight
highway=** (default) 0.77
highway=service 0.73
highway=residential or highway=residential_link 0.77
highway=tertiary or highway=tertiary_link 0.83
highway=secondary or highway=secondary_link 1.25
highway=primary or highway=primary_link 1.75

Shared bike/bus lanes (cycleway=share_busway)

Highway tag Weight
highway=** (default) 0.92
highway=service 0.85
highway=residential or highway=residential_link 0.85
highway=tertiary or highway=tertiary_link 0.92
highway=secondary or highway=secondary_link 0.99
highway=primary or highway=primary_link 1.25
highway=trunk_link or highway=motorway_link 1.25
highway=trunk 1.75
highway=motorway 2.5

Against motorized traffic (cycleway=opposite)

Highway tag Weight (forward, backward)
highway=** (default) 1.0, 1.4
highway=service 1.1, 1.1
highway=residential or highway=residential_link 0.98, 0.98
highway=tertiary or highway=tertiary_link 1, 1
highway=secondary or highway=secondary_link 1.5, 1.71
highway=primary or highway=primary_link 2.06, 2.99

Special weights for additional tags on highway=track

Other tags Weight
bicycle=yes 1.18
bicycle=yes and surface=** 1.18
bicycle=designated 0.99
bicycle=designated and surface=** 0.99
surface=** 1.3

Special weights for surface tags (surface=**)

Surface tag Weight
surface=fine_gravel or surface=sand 100
surface=unpaved or surface=compacted 1.18
surface=cobblestone, surface=paving_stones, surface=grass_paver, surface=pebblestone, surface=gravel, surface=ground, surface=dirt, surface=earth, surface=grass, surface=mud, surface=wood, surface=metal, or surface=artificial_turf 1.5
surface=tartan 3

For the TriMet deployment, a couple of special mixins have also been included that indicate caution areas for cycling that appear in jurisdictional data/maps

Other tags Weight
RLIS:bicycle=caution_area 1.45
CCGIS:bicycle=caution_area 1.45

The above weights also apply to permutations such as cycleway=opposite_lane, cycleway=opposite_track, cycleway:right=**, and cycleway:left=** .


A reasonably new feature for OpenTripPlanner is the ability to read highway=elevator nodes. When these nodes are connected to ways with levels defined by level=** tags, layer=** tags or level_map relations, they should be interpreted correctly.

See also