If you want to do some journey planning in Auckland, basically you have three options:
- Google Directions API - For free API, you can only send 2,500 directions requests per 24 hour period.
- JSONP API used in AT's public site - Not a public API, more like a hack
- Set up your own OpenTripPlanner instance
This post will show how to set up OpenTripPlanner using Auckland data.
OpenTripPlanner (OTP) is an open source trip planner. You need to check out code from GitHub first.
cd /path/to/projects git clone git://github.com/opentripplanner/OpenTripPlanner.git
Then build the source code.
cd OpenTripPlanner mvn clean package
After code is built, download GTFS data from AT's MAXX. OpenStreetMap (OSM) data is also required. Download Auckland's data from here. Select binary PBF OSM data.Put downloaded GTFS and OSM data into the same directory, e.g.
/tmp/pbx, then run
cd /path/to/projects/OpenTripPlanner java -Xmx2G -jar target/otp.jar --build /tmp/pbx
This will generate a
Graph.obj file in
/tmp/pbx directory. Create directory
/var/otp/graphs and copy
Graph.obj file into that directory. Then start OTP server:
java -Xmx2G -jar target/otp.jar --server
After server is started, access http://localhost:8080/index.html for the OTP instance.
After a quick test, the journey planning result is not quite accurate comparing results from Google Maps or AT's MAXX site. More tuning is required for better results.