gtfsrouter

Routing and analysis engine for GTFS (General Transit Feed Specification) data

https://github.com/urbananalyst/gtfsrouter

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.9%) to scientific vocabulary

Keywords

gtfs gtfsrouter public-transportation r-package router
Last synced: 9 months ago · JSON representation

Repository

Routing and analysis engine for GTFS (General Transit Feed Specification) data

Basic Info
Statistics
  • Stars: 94
  • Watchers: 9
  • Forks: 17
  • Open Issues: 13
  • Releases: 7
Topics
gtfs gtfsrouter public-transportation r-package router
Created over 7 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing Codemeta

README.Rmd

# gtfsrouter 

[![R build
status](https://github.com/UrbanAnalyst/gtfsrouter/workflows/R-CMD-check/badge.svg)](https://github.com/UrbanAnalyst/gtfsrouter/actions?query=workflow%3AR-CMD-check)
[![codecov](https://codecov.io/gh/UrbanAnalyst/gtfsrouter/branch/main/graph/badge.svg)](https://app.codecov.io/gh/UrbanAnalyst/gtfsrouter)
[![Project Status: Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/gtfsrouter)](https://cran.r-project.org/package=gtfsrouter) 
[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/grand-total/gtfsrouter?color=orange)](https://cran.r-project.org/package=gtfsrouter)


**R** package for public transport routing with [GTFS (General Transit Feed
Specification)](https://developers.google.com/transit/gtfs/) data.

## Installation

You can install latest stable version of `gtfsrouter` from CRAN with:
```{r cran-installation, eval = FALSE}
install.packages ("gtfsrouter")
```

Alternatively, the current development version can be installed using any of
the following options:

```{r gh-installation, eval = FALSE}
# install.packages("remotes")
remotes::install_git ("https://git.sr.ht/~mpadge/gtfsrouter")
remotes::install_git ("https://codeberg.org/UrbanAnalyst/gtfsrouter")
remotes::install_bitbucket ("urbananalyst/gtfsrouter")
remotes::install_gitlab ("UrbanAnalyst/gtfsrouter")
remotes::install_github ("UrbanAnalyst/gtfsrouter")
```

To load the package and check the version:
```{r pkg-version, eval=TRUE}
library (gtfsrouter)
packageVersion ("gtfsrouter")
```

## Main functions

The main functions can be demonstrated with sample data included with the
package from Berlin (the "Verkehrverbund Berlin Brandenburg", or VBB). GTFS
data are always stored as `.zip` files, and these sample data can be written to
the temporary directory (`tempdir()`) of the current R session with the
function `berlin_gtfs_to_zip()`.

```{r create-zip, eval = TRUE}
filename <- berlin_gtfs_to_zip ()
print (filename)
```

For normal package use, `filename` will specify the name of a local GTFS `.zip`
file. 

### gtfs_route

Given the name of a GTFS `.zip` file, `filename`, routing is as simple as the
following code:

```{r example-echo, echo = TRUE, eval = FALSE}
gtfs <- extract_gtfs (filename)
gtfs <- gtfs_timetable (gtfs, day = "Wed") # A pre-processing step to speed up queries
gtfs_route (gtfs,
    from = "Tegel",
    to = "Berlin Hauptbahnhof",
    start_time = 12 * 3600 + 120
) # 12:02 in seconds
```
```{r example, echo = FALSE, message = FALSE}
gtfs <- extract_gtfs (filename)
gtfs <- gtfs_timetable (gtfs)
r <- gtfs_route (gtfs,
    from = "Schonlein",
    to = "Berlin Hauptbahnhof",
    start_time = 12 * 3600 + 120
) # 12:02 in seconds
knitr::kable (r)
```

### gtfs_traveltimes

The [`gtfs_traveltimes()`
function`](https://UrbanAnalyst.github.io/gtfsrouter/reference/gtfs_traveltimes.html)
calculates minimal travel times from any nominated stop to all other stops
within a feed. It requires the two parameters of start station, and a vector of
two values specifying earliest and latest desired start times. The following
code returns the fastest travel times to all stations within the feed for
services which leave the nominated station ("Alexanderplatz") between 12:00 and
13:00 on a Monday:

```{r isochrone, eval = TRUE, message = FALSE}
gtfs <- extract_gtfs (filename)
gtfs <- gtfs_timetable (gtfs, day = "Monday")
x <- gtfs_traveltimes (gtfs,
    from = "Alexanderplatz",
    start_time_limits = c (12, 13) * 3600
)
```

The function returns a simple table detailing all stations reachable with
services departing from the nominated station and start times:

```{r iso-results1-fakey, eval = FALSE}
head (x)
```
```{r iso-results1, eval = TRUE, echo = FALSE}
knitr::kable (head (x))
```

Further details are provided in a [separate
vignette](https://UrbanAnalyst.github.io/gtfsrouter/articles/traveltimes.html).

### gtfs_transfer_table

Feeds should include a "transfers.txt" table detailing all possible transfers
between nearby stations, yet many feeds omit these tables, rendering them
unusable for routing because transfers between services can not be calculated.
The `gtfsrouter` package also includes a function,
[`gtfs_transfer_table()`](https://UrbanAnalyst.github.io/gtfsrouter/reference/gtfs_transfer_table.html),
which can calculate a transfer table for a given feed, with transfer times
calculated either using straight-line distances (the default), or using more
realistic pedestrian times routed through the underlying street network.

This function can also be used to enable routing through multiple adjacent or
overlapping GTFS feeds. The feeds need simply be merged through binding the
rows of all tables, and the resultant aggregate feed submitted to the
[`gtfs_transfer_table()`](https://UrbanAnalyst.github.io/gtfsrouter/reference/gtfs_transfer_table.html)
function. This transfer table will retain all transfers specified in the
original feeds, yet be augmented by all possible transfers between the multiple
systems up to a user-specified maximal distance. Further details of this
function are also provided in another [separate
vignette](https://UrbanAnalyst.github.io/gtfsrouter/articles/transfers.html).



## Additional Functionality

There are many ways to construct GTFS feeds. For background information, see
[`gtfs.org`](https://gtfs.org), and particularly their [GTFS
Examples](https://docs.google.com/document/d/16inL5BVcM1aU-_DcFJay_tC6Ni0wPa0nvQEstueG5k4/edit).
Feeds may include a "frequencies.txt" table which defines "service periods",
and overrides any schedule information during the specified times. The
`gtfsrouter` package includes a function,
[`frequencies_to_stop_times()`](https://UrbanAnalyst.github.io/gtfsrouter/reference/frequencies_to_stop_times.html),
to convert "frequencies.txt" tables to equivalent "stop_times.txt" entries, to
enable the feed to be used for routing.


## Contributors
















All contributions to this project are gratefully acknowledged using the [`allcontributors` package](https://github.com/ropensci/allcontributors) following the [allcontributors](https://allcontributors.org) specification. Contributions of any kind are welcome!

### Code


mpadge

stmarcin

gmatosferreira

dhersz

polettif
### Issue Authors

sridharraman

orlandombaa

Maxime2506

chinhqho

federicotallis

rafapereirabr

AlexandraKapp

dcooley

bernd886

stefan-overkamp

luukvdmeer

szaboildi

cseveren

jh0ker

zamirD123

viajerus

jmertic

5balls

pteridin

FlxPo

Tom-NutsOne
### Issue Contributors

tbuckl

tuesd4y

Robinlovelace

loanho23

abyrd

hansmib

Owner

  • Name: Urban Analyst
  • Login: UrbanAnalyst
  • Kind: organization
  • Location: Germany

Platform for analysis and visualation of social equitability of urban systems

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "gtfsrouter",
  "description": "Use 'GTFS' (General Transit Feed Specification) data for routing from nominated start and end stations, for extracting 'isochrones', and travel times from any nominated start station to all other stations.",
  "name": "gtfsrouter: Routing with 'GTFS' (General Transit Feed Specification) Data",
  "codeRepository": "https://github.com/UrbanAnalyst/gtfsrouter",
  "issueTracker": "https://github.com/UrbanAnalyst/gtfsrouter/issues",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.1.4.003",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.5.1 (2025-06-13)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Mark",
      "familyName": "Padgham",
      "email": "mark.padgham@email.com"
    },
    {
      "@type": "Person",
      "givenName": "Marcin",
      "familyName": "Stepniak",
      "email": "marcinstepniak@ucm.es",
      "@id": "https://orcid.org/0000-0002-6489-5443"
    }
  ],
  "contributor": [
    {
      "@type": "Person",
      "givenName": "Alexandra",
      "familyName": "Kapp",
      "email": "alk@mobilityinstitute.com"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Mark",
      "familyName": "Padgham",
      "email": "mark.padgham@email.com"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "digest",
      "name": "digest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=digest"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "dodgr",
      "name": "dodgr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=dodgr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "dplyr",
      "name": "dplyr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=dplyr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "ggplot2",
      "name": "ggplot2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=ggplot2"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "here",
      "name": "here",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=here"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "hms",
      "name": "hms",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=hms"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "lubridate",
      "name": "lubridate",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=lubridate"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "lwgeom",
      "name": "lwgeom",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=lwgeom"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "markdown",
      "name": "markdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=markdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "pbapply",
      "name": "pbapply",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=pbapply"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 2.10"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "cli",
      "name": "cli",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=cli"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "data.table",
      "name": "data.table",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=data.table"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "fs",
      "name": "fs",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=fs"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "geodist",
      "name": "geodist",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=geodist"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "methods",
      "name": "methods"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "Rcpp",
      "name": "Rcpp",
      "version": ">= 0.12.6",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=Rcpp"
    },
    "SystemRequirements": {}
  },
  "fileSize": "16150.902KB",
  "releaseNotes": "https://github.com/UrbanAnalyst/gtfsrouter/blob/master/NEWS.md",
  "readme": "https://github.com/UrbanAnalyst/gtfsrouter/blob/main/README.md",
  "contIntegration": [
    "https://github.com/UrbanAnalyst/gtfsrouter/actions?query=workflow%3AR-CMD-check",
    "https://app.codecov.io/gh/UrbanAnalyst/gtfsrouter"
  ],
  "developmentStatus": "https://www.repostatus.org/#active",
  "keywords": [
    "gtfs",
    "public-transportation",
    "router",
    "r-package",
    "gtfsrouter"
  ],
  "relatedLink": "https://CRAN.R-project.org/package=gtfsrouter"
}

GitHub Events

Total
  • Create event: 10
  • Release event: 1
  • Issues event: 7
  • Watch event: 11
  • Delete event: 7
  • Issue comment event: 15
  • Push event: 26
  • Pull request review comment event: 1
  • Pull request review event: 3
  • Pull request event: 18
Last Year
  • Create event: 10
  • Release event: 1
  • Issues event: 7
  • Watch event: 11
  • Delete event: 7
  • Issue comment event: 15
  • Push event: 26
  • Pull request review comment event: 1
  • Pull request review event: 3
  • Pull request event: 18

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 912
  • Total Committers: 6
  • Avg Commits per committer: 152.0
  • Development Distribution Score (DDS): 0.037
Past Year
  • Commits: 37
  • Committers: 2
  • Avg Commits per committer: 18.5
  • Development Distribution Score (DDS): 0.108
Top Committers
Name Email Commits
mpadge m****m@e****m 878
AlexandraKapp a****2@g****m 24
Gonçalo Matos g****s@t****t 4
Marcin Stepniak s****n@g****l 4
Flavio Poletti f****i@h****h 1
Daniel Herszenhut d****z@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 17
  • Total pull requests: 21
  • Average time to close issues: 3 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 6
  • Total pull request authors: 2
  • Average comments per issue: 2.41
  • Average comments per pull request: 0.48
  • Merged pull requests: 17
  • Bot issues: 3
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 20
  • Average time to close issues: about 3 hours
  • Average time to close pull requests: about 9 hours
  • Issue authors: 4
  • Pull request authors: 2
  • Average comments per issue: 0.8
  • Average comments per pull request: 0.5
  • Merged pull requests: 16
  • Bot issues: 2
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mpadge (7)
  • FlxPo (4)
  • github-actions[bot] (3)
  • Tom-NutsOne (2)
  • gmatosferreira (1)
  • pteridin (1)
Pull Request Authors
  • mpadge (20)
  • gmatosferreira (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 372 last-month
  • Total docker downloads: 39
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 24
  • Total maintainers: 1
proxy.golang.org: github.com/urbananalyst/gtfsrouter
  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.5%
Average: 6.7%
Dependent repos count: 7.0%
Last synced: 9 months ago
proxy.golang.org: github.com/UrbanAnalyst/gtfsrouter
  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.5%
Average: 6.7%
Dependent repos count: 7.0%
Last synced: 9 months ago
cran.r-project.org: gtfsrouter

Routing with 'GTFS' (General Transit Feed Specification) Data

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 372 Last month
  • Docker Downloads: 39
Rankings
Forks count: 4.6%
Stargazers count: 4.7%
Average: 18.9%
Docker downloads count: 21.8%
Dependent repos count: 23.8%
Dependent packages count: 28.6%
Downloads: 30.0%
Maintainers (1)
Last synced: 9 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • Rcpp >= 0.12.6 imports
  • cli * imports
  • data.table * imports
  • geodist * imports
  • methods * imports
  • digest * suggests
  • dodgr * suggests
  • dplyr * suggests
  • ggplot2 * suggests
  • here * suggests
  • hms * suggests
  • knitr * suggests
  • lubridate * suggests
  • lwgeom * suggests
  • markdown * suggests
  • pbapply * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/check-standard.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgcheck.yaml actions
  • ropensci-review-tools/pkgcheck-action main composite
.hooks/description cran