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.
write_gtfs(gtfs, zipfile, overwrite = TRUE, quiet = FALSE)
A GTFS data set stored in memory as a list of data.tables/data.frames.
The pathname of a .zip file to be saved with the GTFS data.
A logical. Whether to overwrite an existing .zip
file.
Defaults to TRUE
.
A logical. Whether to hide log messages and progress bars.
Defaults to TRUE
.
The status value returned by the external zip command, invisibly.
library(magrittr)
# 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/Rtmp8QhZHv/gtfsio:
#> * agency.txt
#> * calendar.txt
#> * routes.txt
#> * shapes.txt
#> * stop_times.txt
#> * stops.txt
#> * trips.txt
#> Reading agency.txt
#> Reading calendar.txt
#> Reading routes.txt
#> Reading shapes.txt
#> Reading stop_times.txt
#> Reading stops.txt
#> Reading trips.txt
# write GTFS data into a zip file
write_gtfs(poa, paste0(tempdir(), "/mypoa.zip"))
#> Writing text files to /tmp/Rtmp8QhZHv/gtfsio441b6335b01c
#> - 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/Rtmp8QhZHv/mypoa.zip