View source: R/convert_sf_to_shapes.R
convert_sf_to_shapes | R Documentation |
shapes
tableConverts a LINESTRING sf
object into a GTFS shapes
table.
convert_sf_to_shapes(sf_shapes, shape_id = NULL, calculate_distance = TRUE)
sf_shapes |
A |
shape_id |
A character vector specifying the |
calculate_distance |
A logical. Whether to calculate and populate the
|
A data.table
representing a GTFS shapes
table.
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
# first converting existing shapes table into a sf object
shapes_sf <- convert_shapes_to_sf(gtfs)
head(shapes_sf)
# by default converts all shapes
result <- convert_sf_to_shapes(shapes_sf)
result
# shape_id argument controls which shapes are converted
result <- convert_sf_to_shapes(shapes_sf, shape_id = c("17846", "17847"))
result
# calculate_distance argument controls whether to calculate
# shape_dist_traveled or not
result <- convert_sf_to_shapes(shapes_sf, calculate_distance = TRUE)
result
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.