Learn R Programming

GTFSwizard (version 1.1.0)

get_shapes_sf: Convert GTFS Shapes Table to Simple Features (sf) Format

Description

`get_shapes_sf` converts the shapes table in a `wizardgtfs` object into a simple features (`sf`) object, making it suitable for spatial analysis. This function checks and processes the `shapes` data in the provided GTFS object and structures it as `LINESTRING` features.

Usage

get_shapes_sf(gtfs)

Value

An `sf` object with shapes as `LINESTRING` geometries:

Arguments

gtfs

A GTFS object containing the `shapes` table or the shape table itself. If the `shapes` table is missing, it will be created using `get_shapes()`.

Details

- When the input `wizardgtfs` object lacks a `shapes` table, the function automatically generates one using `get_shapes()`.

- The `shapes` table in the GTFS object are transformed into `LINESTRING` geometries. If `shape_pt_sequence` is absent, the points are treated as ordered by their position in the data.

- If `shape_dist_traveled` is available, cumulative distance calculations are included for each shape point.

See Also

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

Examples

Run this code
# Convert shapes data in a GTFS object to sf format
gtfs_sf <- get_shapes_sf(for_rail_gtfs)

Run the code above in your browser using DataLab