-
Notifications
You must be signed in to change notification settings - Fork 3
FiveMinutes
If you haven't already, please see the 2 minute introduction to running OTP (with Portland & TriMet data).
The intent of this 5 minute lesson is for you to build your own Graph.obj, first using the TriMet data...then using a transit agency GTFS file of your choosing. Going past our 5 minutes, we'll dive into adding elevation data to your graph (which is needed for the nifty street slope chart seen with biking directions), and performance tuning via contraction hierarchies (see below).
-
Download http://maps5.trimet.org/otp-dev/otp.zip (~90 megs). BTW, otp.zip is packaged nightly from the latest OTP source code.
-
Unzip the contents to the / directory (or C:\ for Windows users).
NOTE: it's very important to have the pre-built web app run from /otp (or C:\otp). If you want to run from another location, you'll need to edit the file WEB-INF/classes/data-sources.xml within /otp/webapps/opentripplanner-api-webapp.war.
-
Download OSM street data for Portland http://maps5.trimet.org/otp-dev/or-wa.osm (~300 megs)
-
Move or-wa.osm to the /otp/cache/osm/ directory
-
cd to /otp
-
bin/build-graph.sh (or bin\build-graph.bat for Windows users)
NOTE: this takes awhile...but you should end up with a new Graph.obj file.
-
run bin/graph-vis.sh (or bin\graph-viz.bat for Windows users) to view your new Graph.obj
-
bin/startup.sh (or bin\startup.bat for Windows users), then open http://localhost:8080/opentripplanner-webapp in a web browser to see OTP route around your new graph...
-
See and GraphBuilder for more information on content and configuration of Graph.obj
-
First, find a URL to a GTFS feed that you're interested in (see http://www.gtfs-data-exchange.com/ for ideas).
-
cd /otp
-
open graph-builder.xml in a text editor -- we're going to make two edits
-
edit !#1 - change the GTFS url on/about line 17, from http://developer1.trimet.org/schedule/gtfs.zip to your desired gtfs.zip url path.
-
edit !#2 - specify the OSM data for your region (not the or-wa.osm data). You have two options for acquiring OSM data for your region:
a) if you have an existing .osm file for your region, edit the path from or-wa.osm to that file on line 66 of graph-builder.xml. (BTW, here's the url I use for or-wa.osm -- http://jxapi.openstreetmap.org/xapi/api/0.6/map?bbox=-123.4,44.8,-121.5,45.8).
b) let OTP download the .osm data for your region (based on the stop locations within your gtfs.zip file) -- to make that change, you need to un-comment the RegionBasedOpenStreetMapProviderImpl provider on line 45 of graph-builder.xml, and then comment out the StreamedFileBasedOpenStreetMapProviderImpl provider on line 65 of graph-builder.xml. -
cd to /otp
-
bin/build-graph.sh (or bin\build-graph.bat for Windows users)
NOTE: this takes awhile...but you should end up with a new Graph.obj file.
-
run bin/graph-vis.sh (or bin\graph-viz.bat for Windows users) to view your new Graph.obj
-
bin/startup.sh (or bin\startup.bat for Windows users), then open http://localhost:8080/opentripplanner-webapp in a web browser to see OTP route around your new graph...
-
See and GraphBuilder for more information on content and configuration of Graph.obj
-
We can speed up routing by optimizing the graph. The trade-off is slower graph building.
-
We'll again edit graph-builder.xml, and rebuild our graph.
-
open graph-builder.xml in a text editor
-
uncomment the 'contraction hierarchies' section on line 93.
-
cd to /otp
-
bin/build-graph.sh
NOTE: contraction hierarchies really help to speed up long-distance walk and bike routing (sometimes by many orders of magnitude).
-
etc... see instructions above for running your new graph though otp ...
-
If you want to add elevation data (for the U.S. only -- see http://ned.usgs.gov for more) to your graph, we'll again edit graph-builder.xml
-
open graph-builder.xml in a text editor
-
uncomment the 'nedBuilder' ref on line 118.
-
cd to /otp
-
bin/build-graph.sh
NOTE: NED downloads take a real long time, and the graph building is really slow...
NOTE: Those outside the US can also potentially use another elevation data set...see GraphBuilder#Elevationdata for (not much) more information.
-
etc... see instructions above for running your new graph though otp ...
Good luck...