Skip to content
Brandon Martin-Anderson edited this page Feb 4, 2014 · 50 revisions

Minimal Introduction to OTP

Here's how to get a standalone instance of OTP running.

Some things you'll need:

  • A Linux or Mac machine with over 1GB memory.
  • A number of supporting software packages, including:
  • git
  • maven2

Get OTP

$ cd /path/to/projects
$ git clone [email protected]:opentripplanner/OpenTripPlanner.git

Build OTP

$ cd OpenTripPlanner
$ mvn clean package

This stage takes a while. If it completes with a message like BUILD FAILED, then the rest of this tutorial won't work.

Build a graph

A graph is a file that combines and links transportation information from a number of sources into a form that's easy for OTP use. Basic graphs use OpenStreetMap road data, and public transport data in GTFS format.

First, download a GTFS from your favorite city. Here's the GTFS for Portland's Trimet system.

$ cd /path/to/downloads
$ mkdir pdx
$ wget "http://developer.trimet.org/schedule/gtfs.zip" -O trimet.gtfs.zip

Then, get a subset of OpenStreetMap data corresponding to the same area. There are many ways to get OSM data. One convenient way is a collection of metro extracts compiled by Michal Migurski.

$ wget http://osm-extracted-metros.s3.amazonaws.com/portland.osm.pbf

Build the graph

$ cd /path/to/projects/OpenTripPlanner
$ java -Xmx2G -jar otp-core/target/otp.jar --build /path/to/downloads/pdx

Run the server

Make a /var/otp/graphs directory if necessary, and copy the graph there

$ sudo mkdir /var/otp/graphs
$ mv /path/to/downloads/pdx/Graph.obj /var/otp/graphs

Then head over to the OTP directory and run the server:

$ cd /path/to/projects/OpenTripPlanner
$ java -Xmx2G -jar otp-core/target/otp.jar --server

This will take a minute. Once you see Grizzly server running. check out http://localhost:8080/

Once the server starts up, you can also try some REST API URLs to verify that it's working:

  • http://localhost:8080/otp-rest-servlet/ws/metadata
  • http://localhost:8080/otp-rest-servlet/ws/routers

You could also do:

java -jar otp-core/target/otp.jar -p 9090 -r mexico --server

in order to run on port 9090 and load the graph for routerId 'mexico'. You can also specify the base directory for graphs with -g. As we continue to work on standalone mode, it should continue to function in the same way but just be enriched with more command line options. Try the --help option for a full list of command line parameters.

Advanced graph building

See the 5 minute detailed dive-in for instructions on advanced graph-building techniques (carshare, bikeshare, elevation &c)...

The documentation on this wiki is outdated and should not be used

unless you are intentionally working with legacy versions of OpenTripPlanner. Please consult the current documentation at readthedocs

Clone this wiki locally