Nothing
gtsf
is an R package for using GTFS data as simple
features. You can also
use it to make shapefiles and geojson from GTFS data.
You can install this package from GitHub using the devtools package:
if (!require(devtools)) {
install.packages('devtools')
}
devtools::install_github('r-gtfs/gtsf')
Import transit lines from the NYC Subway using trread
.
library(trread)
library(gtsf)
library(dplyr)
NYC <- import_gtfs("http://web.mta.info/developers/data/nyct/subway/google_transit.zip")
#> [1] "agency.txt" "calendar_dates.txt" "calendar.txt"
#> [4] "routes.txt" "shapes.txt" "stop_times.txt"
#> [7] "stops.txt" "transfers.txt" "trips.txt"
NYC <- gtfs_as_sf(NYC)
This adds two simple features dataframes to the list of GTFS objects: -stops_sf -routes_sf
These can be mapped with various libraries. For example, with the tmap package:
library(tmap)
routes_sf <- NYC$sf_routes
qtm(routes_sf)
They can also be exported to geojson, for use elsewhere. For example:
library(sf)
st_write(NYC$sf_routes,"nyc_routes.geojson", delete_dsn = TRUE)
#> Deleting source `nyc_routes.geojson' failed
#> Writing layer `nyc_routes' to data source `nyc_routes.geojson' using driver `GeoJSON'
#> features: 25
#> fields: 1
#> geometry type: Multi Line String
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.