This vignette outlines how to produce GTFS timetables for the heavy rail network using ATOC CIF files.
Data for train timetables can be downloaded from ATOC you will need to register for a free account and log in.
You will get a zipped folder with a name like
ttis123.zip
.
To do a simple conversion to GTFS, load the package, and use the
atoc2gtfs
function. The function requires the following
arguments.
path_in
is the file path to the ATOC timetable file,
this comes a zipped folder with a name like
ttis627.zip
ncores
If > 1 then multicore processing is used to
speed up the processing. Always leave one spare core for your OS.A simple example is shown below:
Once the conversion has been completed, you can save the GTFS file.
gtfs_write(gtfs,
folder = "C:/GTFS",
name = "gtfs_ttis627")
This will save the GTFS file to
C:/GTFS/gtfs_ttis627.zip
CIF Files are available from Network Rail, the formatting is slightly
different and so a separate function nr2gtfs()
is
provided.
The atoc2gtfs()
function gives some customization
options to how the GTFS file is built. It is also just a wrapper around
other functions in the package. This section will explain the main
steps.
After unzipping the folder, the reading of the ATOC data is done with the following functions:
importMCA()
the main file with the timetable data,importFLF()
optional file used if
transfers = TRUE
importMSN()
optional file used if
locations = "file"
Other files are currently ignored.
The timetable data refers to locations such as stations, junctions,
etc using a TIPLOC id. The locations of these are stored in the
.msn
file, but are not always accurate. Therefore the
package comes with a tiplocs
object which includes improved
location data for TIPLOCS.
IF you wanted to build using the locations included in the ATOC data,
then you can use locations = "file"
in
atoc2gtfs()
or manually build the stops using
station2stops()
.