
The `get_shapes` function reconstructs the `shapes` table for a GTFS dataset using an approximation based on stop coordinates and sequence information. It creates geometric representations of trips by connecting stops in sequence for each trip.
get_shapes(gtfs)
A modified GTFS object that includes a `shapes` table derived from the stops and trips information.
A GTFS object, ideally of class `wizardgtfs`. If not, it will be converted automatically.
This function constructs the `shapes` table by sequentially connecting stops along each trip using a Euclidean approximation. If the GTFS object already contains a `shapes` table, it will be overwritten, and a warning will be displayed. The process involves:
- Selecting and arranging stops by trip and sequence
- Connecting stops with line segments to form a path for each trip
- Grouping unique paths into distinct shape IDs
[GTFSwizard::as_wizardgtfs()], [GTFSwizard::get_shapes_df()]
# Generate a shapes table for a GTFS object
gtfs_with_shapes <- get_shapes(gtfs = for_rail_gtfs)
Run the code above in your browser using DataLab