Build shapes from simple feature object
Details
This function builds the shapes.txt file from a simple feature object.
It first converts any MULTILINESTRING geometries to LINESTRING geometries using the
multiline_to_sorted_linestring, with the first stop of each trip as the starting point.
Then, it converts the LINESTRING geometries to a data.table representing a GTFS shapes table using
gtfstools::convert_sf_to_shapes.
Examples
if (FALSE) { # \dontrun{
gtfs <- GTFShift::load_feed("gtfs.zip")
q <- opq("Lisbon") |>
add_osm_feature(key = "route", value = c("bus", "tram")) |>
add_osm_feature(key = "network", value = "Carris", key_exact = TRUE)
shapes_sf <- GTFShift::osm_shapes_to_routes(gtfs, q)
gtfs$shapes <- GTFShift::create_shapes_from_sf(shapes_sf, gtfs)
} # }
