50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

GTFSwizard (version 1.1.0)

get_shapes: Generate Shapes Table for GTFS Data

Description

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.

Usage

get_shapes(gtfs)

Value

A modified GTFS object that includes a `shapes` table derived from the stops and trips information.

Arguments

gtfs

A GTFS object, ideally of class `wizardgtfs`. If not, it will be converted automatically.

Details

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

See Also

[GTFSwizard::as_wizardgtfs()], [GTFSwizard::get_shapes_df()]

Examples

Run this code
# 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