Transit Stops

Harold Nelson

11/9/2021

Setup

library(tidyverse)
library(sf)
library(tmap)

Data Source

This data can be obtained at https://wsdot.wa.gov/mapsdata/products/gisdata.htm.

There is a video walkthrough at https://www.youtube.com/watch?v=7mDPECpRIhY

To see the video, right-click and open in a new tab or window.

Examine GDB

st_layers("TransitStops.gdb")
## Driver: OpenFileGDB 
## Available layers:
##     layer_name geometry_type features fields
## 1 TransitStops         Point    20327      6

There is only one layer, so it’s simple to read.

Read and Plot

ts = st_read("TransitStops.gdb")
## Reading layer `TransitStops' from data source 
##   `/Users/haroldnelson/Dropbox/WA Geodata/TransitStops.gdb' using driver `OpenFileGDB'
## Simple feature collection with 20327 features and 6 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: 626083.8 ymin: 67252.06 xmax: 2532432 ymax: 1343139
## Projected CRS: NAD83(HARN) / Washington South (ftUS)
tm_shape(ts) + tm_dots()

Thurston County

Let’s focus on just the stops in Thurston County.

load("counties_us.Rdata")
Thurston = counties_us %>% 
  filter(STATEFP == 53 &
           NAME == "Thurston")

thecrs = st_crs(ts)
Thurston = st_transform(Thurston,thecrs)
ts_th = st_intersection(ts,Thurston)
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
tm_shape(Thurston) +
  tm_borders(col="red",lwd = 2) +
tm_shape(ts_th) + 
  tm_dots(col = "blue",size = .01)