https://github.com/r-transit/gtfsio
Read and Write General Transit Feed Specification (GTFS)
https://github.com/r-transit/gtfsio
gtfs r
Last synced: 6 months ago
JSON representation
Read and Write General Transit Feed Specification (GTFS)
- Host: GitHub
- URL: https://github.com/r-transit/gtfsio
- Owner: r-transit
- License: other
- Created: 2021-02-22T21:22:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T13:13:39.000Z (7 months ago)
- Last Synced: 2025-04-10T16:18:31.039Z (6 months ago)
- Topics: gtfs, r
- Language: R
- Homepage: https://r-transit.github.io/gtfsio/
- Size: 855 KB
- Stars: 14
- Watchers: 4
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Codemeta: codemeta.json
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# gtfsio
![]()
[](https://CRAN.R-project.org/package=gtfsio)
[](https://dhersz.r-universe.dev)
[](https://github.com/r-transit/gtfsio/actions?query=workflow%3AR-CMD-check)
[](https://app.codecov.io/gh/r-transit/gtfsio?branch=master)
[](https://lifecycle.r-lib.org/articles/stages.html)
[](https://CRAN.R-project.org/package=gtfsio)**gtfsio** offers tools for the development of GTFS-related packages. It establishes a standard for representing GTFS feeds using R data types based on [Google's Static GTFS Reference](https://developers.google.com/transit/gtfs/reference). It provides fast and flexible functions to read and write GTFS feeds while sticking to this standard. It defines a basic `gtfs` class which is meant to be extended by packages that depend on it. And it also offers utility functions that support checking the structure of GTFS objects.
## Installation
Stable version:
```{r, eval = FALSE}
install.packages("gtfsio")
```Development version:
```{r, eval = FALSE}
install.packages("gtfsio", repos = "https://dhersz.r-universe.dev")# or
# install.packages("remotes")
remotes::install_github("r-transit/gtfsio")
```## Usage
GTFS feeds are read using the `import_gtfs()` function:
```{r}
library(gtfsio)path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")
gtfs <- import_gtfs(path)
names(gtfs)
````import_gtfs()` returns a `gtfs` object. The `gtfs` class might be extended by other packages using the constructor, validator and methods provided by **gtfsio**:
```{r}
class(gtfs)
```Use the `export_gtfs()` function to write GTFS objects to disk:
```{r}
tmpf <- tempfile(fileext = ".zip")export_gtfs(gtfs, tmpf)
zip::zip_list(tmpf)$filename
```For a more complete demonstration please read the [introductory vignette](https://r-transit.github.io/gtfsio/articles/gtfsio.html).
## GTFS-related packages
- [`{tidytransit}`](https://github.com/r-transit/tidytransit)
- [`{gtfs2gps}`](https://github.com/ipeaGIT/gtfs2gps)
- [`{gtfsrouter}`](https://github.com/UrbanAnalyst/gtfsrouter)
- [`{gtfstools}`](https://github.com/ipeaGIT/gtfstools)