get_stops_sf {GTFSwizard} | R Documentation |
Convert GTFS Stops Table to Simple Features (sf) Format
Description
'get_stops_sf' converts the stops table in a 'wizardgtfs' object into a simple features ('sf') object, making it suitable for spatial analysis. This function checks the format of the 'stops' data and structures it as point geometries.
Usage
get_stops_sf(gtfs)
Arguments
gtfs |
A 'wizardgtfs' object containing a 'stops' table or the stops table itself as a data frame. |
Details
- When the input 'stops' table is not in 'sf' format, this function converts it to 'sf' by using the coordinates in the 'stop_lon' and 'stop_lat' columns.
- The resulting 'sf' object is assigned a CRS of WGS 84 (EPSG:4326) for geographic compatibility.
- If the 'stops' table is already in 'sf' format, the function simply reassigns the CRS and returns it unchanged.
Value
An 'sf' object with stops as point geometries or a 'wizardgtfs' object.
See Also
[GTFSwizard::get_shapes()], [GTFSwizard::get_shapes_sf()], [GTFSwizard::get_shapes_df()]
Examples
# Convert stops data in a GTFS object to sf format
gtfs_sf <- get_stops_sf(for_rail_gtfs)