This function returns an SF multilinestring of the route alignments from
GTFS shapes. Similar to tidytransit::get_geometry(), but allows filtering
by shape_id and projection to a new coordinate system. See Details for
requirements on the input GTFS.
Arguments
- gtfs
A
tidygtfsobject.- shape
Optional. A vector of GTFS
shape_ids to pull. Default is NULL, where allshape_ids ingtfswill be used.- project_crs
Optional. A numeric EPSG identifer indicating the coordinate system to use for spatial calculations. Consider setting to a Euclidian projection, such as the appropriate UTM zone. Default is 4326 (WGS 84 ellipsoid).
Details
A shapes file must be present in your GTFS object. This file must contain
at least the following fields:
shape_idshape_pt_latshape_pt_lonshape_pt_sequence
Examples
# Set my parameters
my_shape <- "804EB_RC_221121"
my_crs = 32611
# Get shape from WMATA GTFS
lineE_shape <- get_shape_geometry(gtfs = lacmta_gtfs,
shape = my_shape,
project_crs = my_crs)
print(lineE_shape)
#> Simple feature collection with 1 feature and 1 field
#> Geometry type: MULTILINESTRING
#> Dimension: XY
#> Bounding box: xmin: 362276 ymin: 3764673 xmax: 393555.7 ymax: 3768928
#> Projected CRS: WGS 84 / UTM zone 11N
#> # A tibble: 1 × 2
#> shape_id geometry
#> <chr> <MULTILINESTRING [m]>
#> 1 804EB_RC_221121 ((362276 3764673, 362291.9 3764699, 362324.6 3764751, 362332.…
