transport_model {gtfs2emis} | R Documentation |
Transport model
Description
This function converts a public transport data set in GTFS format into a
GPS-like table with the space-time positions and speeds of public transport
vehicles. The function also allow users to set the spatial resolution of the
output and to adjust the speed of public transport vehicles given a
min_speed
and max_speed
range.
Usage
transport_model(
gtfs_data,
min_speed = 2,
max_speed = 80,
new_speed = NULL,
parallel = TRUE,
ncores = NULL,
spatial_resolution = 100,
output_path = NULL,
continue = FALSE
)
Arguments
gtfs_data |
A path to a GTFS file or a GTFS data organized as a list of
|
min_speed |
numeric (in km/h) or a speed units value. Minimum speed to
be considered as valid. Values below minimum speed will be updated
according to the |
max_speed |
numeric (in km/h) or a speed units value. Maximum speed to
be considered as valid. Values above maximum speed will be updated
according to the |
new_speed |
numeric (in km/h) or a speed units value. Speed value used
to replace the speeds that fall outside the |
parallel |
logical. Decides whether the function should run in parallel.
Defaults is |
ncores |
integer. Number of cores to be used in parallel execution. This
argument is ignored if parallel is |
spatial_resolution |
The spatial resolution in meters. Defaults to |
output_path |
character. A directory path. If |
continue |
logical. Argument that can be used only with output_path When TRUE, it skips processing the shape identifiers that were already saved into files. It is useful to continue processing a GTFS file that was stopped for some reason. Default value is FALSE. |
Value
A data.table sf_linestring
object or NULL
.
See Also
Other Core function:
emission_model()
Examples
library(gtfs2emis)
library(gtfstools)
# read GTFS
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
gtfs <- gtfstools::read_gtfs(gtfs_file)
# keep a single trip_id to speed up this example
gtfs_small <- gtfstools::filter_by_trip_id(gtfs, trip_id ="4451136")
# run transport model
tp_model <- transport_model(gtfs_data = gtfs_small,
min_speed = 2,
max_speed = 80,
new_speed = 20,
spatial_resolution = 100,
parallel = FALSE)