https://github.com/r-transit/gtsf
NOTE: deprecated. see tidytransit. General Transit - Simple Features
https://github.com/r-transit/gtsf
Last synced: 3 months ago
JSON representation
NOTE: deprecated. see tidytransit. General Transit - Simple Features
- Host: GitHub
- URL: https://github.com/r-transit/gtsf
- Owner: r-transit
- Archived: true
- Created: 2018-07-01T21:00:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T04:18:28.000Z (over 7 years ago)
- Last Synced: 2024-05-16T19:02:56.326Z (over 1 year ago)
- Language: R
- Homepage:
- Size: 47.8 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- awesome-transit - gtsf - general transit (GTFS) simple (geographic) features (sf) in R. can be used to convert from GTFS to Shapefile, GeoJSON, and other formats through GDAL. (Producing Data / GTFS)
- awesome-transit - gtsf - general transit (GTFS) simple (geographic) features (sf) in R. can be used to convert from GTFS to Shapefile, GeoJSON, and other formats through GDAL. (Uncategorized / Uncategorized)
README
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
cache = FALSE,
comment = "#>",
message = FALSE,
error = FALSE,
warning = FALSE,
fig.path = "README/README-",
fig.width=7.3,
fig.height=5,
out.width = '100%'
)
```
## Description
`gtsf` is an R package for using GTFS data as [simple features](https://en.wikipedia.org/wiki/Simple_Features). You can also use it to make shapefiles and geojson from GTFS data.
## Installation
You can install this package from GitHub using the devtools package:
```
if (!require(devtools)) {
install.packages('devtools')
}
devtools::install_github('r-gtfs/gtsf')
```
## Example Usage
Import transit lines from the NYC Subway using `trread`.
```{r readme-body}
library(trread)
library(gtsf)
library(dplyr)
NYC <- import_gtfs("http://web.mta.info/developers/data/nyct/subway/google_transit.zip")
```
## Get Simple Features
```{r}
NYC <- gtfs_as_sf(NYC)
```
This adds two simple features dataframes to the list of GTFS objects:
-stops_sf
-routes_sf
## Make Maps
These can be mapped with various libraries. For example, with the [tmap](https://cran.r-project.org/web/packages/tmap/vignettes/tmap-nutshell.html) package:
```{r}
library(tmap)
routes_sf <- NYC$sf_routes
qtm(routes_sf)
```
## Export (GeoJSON/Shapefile)
They can also be exported to geojson, for use elsewhere. For example:
```{r}
library(sf)
st_write(NYC$sf_routes,"nyc_routes.geojson", delete_dsn = TRUE)
```