get_shapes_geometry: Get the 'shapes' table with spatial geometry

View source: R/get_shapes_geometry.R

get_shapes_geometryR Documentation

Get the shapes table with spatial geometry

Description

Converts the shapes table to a ⁠LINESTRING sf⁠ object.

Usage

get_shapes_geometry(gtfs, shape_id = NULL, crs = 4326)

Arguments

gtfs

A GTFS object, as created by read_gtfs().

shape_id

A character vector including the shape_ids to be converted. If NULL (the default), all shapes are converted.

crs

The CRS of the resulting object, either as an EPSG code or as an crs object. Defaults to 4326 (WGS 84).

Value

A ⁠LINESTRING sf⁠ object.

Examples


# read gtfs
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)

shapes_sf <- get_shapes_geometry(gtfs)
head(shapes_sf)

shapes_sf <- get_shapes_geometry(gtfs, shape_id = "17846")
shapes_sf


gtfstools documentation built on Oct. 28, 2026, 5:13 p.m.