Calcuating Miles of the Speed Limit on Touring Routes

From the department of neat things you can do with a few lines of R code.

library(tidyverse)
library(arcpullr)

arcpullr::get_spatial_layer('https://gis.dot.ny.gov/hostingny/rest/services/Roadways/RoadwayData/FeatureServer/1') %>%
  filter(Posted_Speed_Limit_MPH > 10) %>%
  mutate(Length = st_length(geoms)) %>%
  st_drop_geometry() %>%
  group_by(Posted_Speed_Limit_MPH) %>%
  summarise(Miles = sum(Length) %>% units::set_units('mi') %>% units::drop_units())

Leave a Reply

Your email address will not be published. Required fields are marked *