export_gtfs: Export GTFS objects

View source: R/export_gtfs.R

export_gtfsR Documentation

Export GTFS objects

Description

Writes GTFS objects to disk as GTFS transit feeds. The object must be formatted according to the standards for reading and writing GTFS transit feeds, as specified in get_gtfs_standards (i.e. data types are not checked). If present, does not write auxiliary tables held in a sub-list named ".".

Usage

export_gtfs(
  gtfs,
  path,
  files = NULL,
  standard_only = FALSE,
  compression_level = 9,
  as_dir = FALSE,
  overwrite = TRUE,
  quiet = TRUE
)

Arguments

gtfs

A GTFS object.

path

A string. Where the resulting .zip file must be written to.

files

A character vector. The name of the elements to be written to the feed.

standard_only

A logical. Whether only standard files and fields should be written (defaults to TRUE, which drops extra files and fields).

compression_level

A numeric, between 1 and 9. The higher the value, the best the compression, which demands more processing time. Defaults to 9 (best compression).

as_dir

A logical. Whether the feed should be exported as a directory, instead of a .zip file. Defaults to FALSE.

overwrite

A logical. Whether to overwrite an existing .zip file (defaults to TRUE).

quiet

A logical. Whether to hide log messages and progress bars (defaults to TRUE).

Value

Invisibly returns the same GTFS object passed to gtfs.

See Also

get_gtfs_standards

Other io functions: import_gtfs()

Examples

gtfs_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")

gtfs <- import_gtfs(gtfs_path)

tmpf <- tempfile(pattern = "gtfs", fileext = ".zip")

export_gtfs(gtfs, tmpf)
zip::zip_list(tmpf)$filename

export_gtfs(gtfs, tmpf, files = c("shapes", "trips"))
zip::zip_list(tmpf)$filename


gtfsio documentation built on Oct. 20, 2023, 9:08 a.m.