Skip to content

Instantly share code, notes, and snippets.

@vgXhc
Created February 14, 2023 11:56
Show Gist options
  • Save vgXhc/029a1e61419963afb7661d661420b1cc to your computer and use it in GitHub Desktop.
Save vgXhc/029a1e61419963afb7661d661420b1cc to your computer and use it in GitHub Desktop.
# code to get all stop locations from a GTFS feed and save them as a shapefile
library(tidytransit)
library(sf)
# find your agency's GTFS feed on https://openmobilitydata.org/feeds
gtfs <- read_gtfs("http://kamino.mcts.org/gtfs/google_transit.zip")
stops <- gtfs$stops
stops_sf <- st_as_sf(stops, coords = c("stop_lon", "stop_lat"))
# you can specify other output formats too
st_write(stops_sf, "stops.shp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment