Write GTFS stored in memory as a list of data.tables into a zipped GTFS feed. This function overwrites the zip file if it exists.
Arguments
- gtfs
A GTFS data set stored in memory as a list of data.tables/data.frames.
- zipfile
The pathname of a .zip file to be saved with the GTFS data.
- overwrite
A logical. Whether to overwrite an existing
.zip
file. Defaults toTRUE
.- quiet
A logical. Whether to hide log messages and progress bars. Defaults to
TRUE
.
Examples
# read a gtfs.zip to memory
poa <- read_gtfs(system.file("extdata/poa.zip", package = "gtfs2gps")) |>
gtfstools::filter_by_shape_id("T2-1") |>
filter_single_trip()
#> Unzipped the following files to /tmp/RtmpVbDcru/gtfsio:
#> * agency.txt
#> * calendar.txt
#> * routes.txt
#> * shapes.txt
#> * stop_times.txt
#> * stops.txt
#> * trips.txt
#> Reading agency
#> Reading calendar
#> Reading routes
#> Reading shapes
#> Reading stop_times
#> Reading stops
#> Reading trips
# write GTFS data into a zip file
write_gtfs(poa, paste0(tempdir(), "/mypoa.zip"))
#> Writing text files to /tmp/RtmpVbDcru/gtfsio1c1976628658
#> - Writing agency.txt
#> - Writing calendar.txt
#> - Writing routes.txt
#> - Writing shapes.txt
#> - Writing stop_times.txt
#> - Writing stops.txt
#> - Writing trips.txt
#> GTFS object successfully zipped to /tmp/RtmpVbDcru/mypoa.zip