Learn R Programming

gtfstools

gtfstools offers a set of convenient tools for editing and analysing transit feeds in GTFS format. Feeds are read as a list of data.tables, allowing for easy and fast data manipulation. Many of this package’s features are based on functions from other packages, especially {tidytransit} and {gtfs2gps}.

Installation

Stable version:

install.packages("gtfstools")

Development version:

# either
install.packages("gtfstools", repos = "https://dhersz.r-universe.dev")

# or
# install.packages("remotes")
remotes::install_github("ipeaGIT/gtfstools")

This package requires a working installation of {sf}. Please check this link for more information on how to install it.

Usage

Please read gtfstools vignettes for more on the package usage:

  • Basic usage: reading, analysing, manipulating and writing feeds. Run vignette("gtfstools") or check it on the website (Introduction to gtfstools).
  • Filtering GTFS feeds. Run vignette("filtering", package = "gtfstools") or check it on the website (Filtering GTFS feeds).
  • Validating GTFS feeds. Run vignette("validating", package = "gtfstools") or check it on the website (Validating GTFS feeds).

Related packages

Acknowledgement

gtfstools is developed by a team at the Institute for Applied Economic Research (Ipea), Brazil.

Copy Link

Version

Install

install.packages('gtfstools')

Monthly Downloads

807

Version

1.4.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Herszenhut

Last Published

January 9th, 2025

Functions in gtfstools (1.4.0)

filter_by_route_id

Filter GTFS object by route_id
filter_by_stop_id

Filter GTFS object by stop_id
filter_by_trip_id

Filter GTFS object by trip_id
get_stop_times_patterns

Get stop times patterns
filter_by_time_of_day

Filter GTFS object by time of day
get_trip_duration

Get trip duration
get_parent_station

Get parent stations recursively
get_children_stops

Get children stops recursively
filter_by_weekday

Filter GTFS object by weekday
frequencies_to_stop_times

Convert frequencies to stop times
get_trip_length

Get trip length
get_trip_geometry

Get trip geometry
set_trip_speed

Set trip average speed
string_to_seconds

Convert time string to seconds after midnight
gtfstools

gtfstools: General Transit Feed Specification (GTFS) Editing and Analysing Tools
remove_duplicates

Remove duplicated entries
get_trip_segment_duration

Get trip segments' duration
get_trip_speed

Get trip speed
integer_to_date

Convert an integer vector into a Date vector
seconds_to_string

Convert seconds after midnight to time string
merge_gtfs

Merge GTFS files
write_gtfs

Write GTFS files
validate_gtfs

Validate GTFS feed
read_gtfs

Read GTFS files
convert_to_standard

Convert a gtfstools' GTFS into a standards-compliant GTFS
convert_time_to_seconds

Convert time fields to seconds after midnight
convert_sf_to_shapes

Convert a simple feature object into a shapes table
convert_shapes_to_sf

Convert shapes table to simple feature object
convert_stops_to_sf

Convert stops table to simple feature object
as_dt_gtfs

Coerce lists and GTFS objects from other packages into gtfstools-compatible GTFS objects
copy_gtfs_without_field

Make a GTFS copy without a given field from a given file
copy_gtfs_without_file

Make a GTFS copy without a given file
copy_gtfs_diff_field_class

Make a GTFS copy with a field of a different class
convert_from_standard

Convert a standards-compliant GTFS into a gtfstools' GTFS
filter_by_agency_id

Filter GTFS object by agency_id
filter_by_route_type

Filter GTFS object by route_type (transport mode)
filter_by_sf

Filter a GTFS object using a simple features object (deprecated)
date_to_integer

Convert a Date vector into an integer vector
download_validator

Download MobilityData's GTFS validator
filter_by_shape_id

Filter GTFS object by shape_id
filter_by_spatial_extent

Filter a GTFS object using a spatial extent
filter_by_service_id

Filter GTFS object by service_id