-
Notifications
You must be signed in to change notification settings - Fork 1k
Minimal Introduction
Here's how to get an instance of OTP up and running quickly. In this tutorial you'll be using the "master" branch of OTP, the one on which most active development occurs.
Some things you'll need:
- A Linux or Mac machine with over 1GB memory. OTP should work on any platform with Java, but the filenames and commands in this page use UNIX-like conventions.
- A number of supporting software packages, including:
- git (a version control system)
- maven2 (a build system)
$ cd /path/to/projects
$ git clone git://github.com/opentripplanner/OpenTripPlanner.git
$ 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.
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
$ cd 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" originally compiled by Michal Migurski and now maintained by Mapzen at https://mapzen.com/metro-extracts/. You'll want to get map data in the OSM PBF format, which is much more compact and faster to load than the older XML format.
$ wget https://s3.amazonaws.com/metro-extracts.mapzen.com/portland.osm.pbf
Build the graph
$ cd /path/to/projects/OpenTripPlanner
$ java -Xmx2G -jar target/otp.jar --build /path/to/downloads/pdx
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 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 web service URLs to verify that it's working:
http://localhost:8080/otp/routers/default/
http://localhost:8080/otp/routers/default/index/routes
You could also do:
java -jar 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.
See the 5 minute detailed dive-in for instructions on advanced graph-building techniques (carshare, bikeshare, elevation &c)...
unless you are intentionally working with legacy versions of OpenTripPlanner. Please consult the current documentation at readthedocs