knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The UK has two main sources of public transport timetable data traveline publishes data on buses and light rail and ATOC pubishes data on heavy rail. Each uses a data fromat that is unique to that organisation and both formats are old and difficult to use. Many countires have adopeted the GTFS format which was developed by Google as a simple standard for publishing timetable data. Due to the wide-spread adoption of GTFS many useful tools have been develope that accept GTFS files as inputs. This package is intended to make the conversion of UK data to the GTFS format simple and easy.
There are a number of pre-existing options for converting data to GTFS. This package aims to go beyond basic conversion by providing a range or additonal fucntionality:
You can install the UK2GTFS package using the devtools package.
install.packages("devtools") # If you do not already have the devtools package devtools::install_github("mem48/UK2GTFS")
Data for trains can be downloaded from http://data.atoc.org/how-to you will need to register for a free account and login.
Data for other modes can be downloaded from https://www.travelinedata.org.uk/traveline-open-data/data-reporting/ you will need to apply for access to the FTP sever to download the data.
Load the package, and use the atoc2gtfs
function. The fucntnon requires the following arguments.
path_in
is the file path to the ATOC timetable file, this comes a ziped folder with a name like ttis123.zip
path_out
is the path to a folder where the results will be savedname
is the file name of the result by default gtfs.zip
silent
if FALSE extra information is displayed duing processingncores
If > 1 then mulicore processing is used to speed up the processinglocations
station locations can be tiplocs
object provided with the package (default) or taken from the ATOC "file"
(known to have errors) or file path to CSV file.agency
agency details which are not included in the network rail files, default used example data provided by the packagelibrary(UK2GTFS) #path_in = "C:/Users/Malcolm/OneDrive - University of Leeds/UK Trains Timetables/ATOC Data/2019-08-31/ttis381.zip" #path_out = "C:/Users/Malcolm/OneDrive - University of Leeds/UK Trains Timetables/ATOC Data/2019-08-31/" path_in = "E:/OneDrive - University of Leeds/UK Trains Timetables/ATOC Data/2019-08-31/ttis381.zip" path_out = "E:/OneDrive - University of Leeds/UK Trains Timetables/ATOC Data/2019-08-31/" atoc2gtfs(path_in = path_in, path_out = path_out, name = "gtfs4", silent = FALSE, ncores = 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.