TL;DR This gem is deprecated and will no longer be maintained. You should source data from the Queensland Government.
This project was created to source public transport data for South-East Queensland. The Queensland Government has since released the data on their own website under a liberal license. I encourage you to source your data from an officially supported source.
TransLink (Organisation) coordinates public transport operations in South-East Queensland. Their website has an abundance of data with no easy way for a developer to query it.
Translink (Program) scrapes bus routes, trips, stops and times into a relational database. The schema is a subset of the General Transit Feed Specification. Data is sourced from the TransLink website.You should be aware their data is protected by copyright.
Translink (Program) was created to provide data for my iOS app, Next Stop.
Translink requires Ruby 1.9.2 or greater. For documentation on how to install Ruby on your platform, visit the Download Ruby page.
Translink is available as a gem. On UNIX-like platforms, install translink from the command line.
$ [sudo] gem install translink
Scrape all bus stops, routes and services for Thursday, 24 November 2011 saving them into a SQLite database named "2011-11-24.sqlite3" in the current working directory.
$ translink scrape 2011-11-24
Change the path to the SQLite database.
$ translink scrape 2011-11-24 ~/Downloads/translink.sqlite3
Get a specific route.
$ translink scrape 2011-11-24 ~/Desktop/translink.sqlite3 http://jp.translink.com.au/travel-information/network-information/buses/435/2011-11-24 0"
Stops the 130 visits on the outbound trip.
SELECT stops.*, stop_times.*
FROM routes
INNER JOIN trips ON trips.route_id = routes.route_id
INNER JOIN stop_times ON stop_times.trip_id = trips.trip_id
INNER JOIN stops ON stops.stop_id = stop_times.stop_id
WHERE routes.short_name = '130' AND trips.headsign = 'outbound'
GROUP BY stops.stop_id
ORDER BY stop_times.stop_sequence;
Routes that visit the 'Calam Rd near Honeywood St' stop.
SELECT DISTINCT(routes.short_name) FROM stops
INNER JOIN stop_times ON stop_times.stop_id = stops.stop_id
INNER JOIN trips ON stop_times.trip_id = trips.trip_id
INNER JOIN routes ON routes.route_id = trips.route_id
WHERE stops.stop_name = 'Calam Rd near Honeywood St';
Schema is a subset of the General Transit Feed Specification defined by Google for Google Transit.
trips.service_id
is omitted. This cannot be extracted from the dataset.routes.agency_id
is omitted. There is only one agent. The agent is Brisbane Transport.If you would like to help, please browse the issues.
bundle install
)git checkout -b my-new-feature
)rake test
)git commit -am 'Added some feature'
)git push origin my-new-feature
)Doing something interesting with this data? Shoot me an e-mail. I'd love to see how this is being used. An acknowledgement of this project is appreciated, but not required.
Copyright © 2011-2012 Tate Johnson. Released under the MIT license. See LICENSE.