Skip to content

Instantly share code, notes, and snippets.

@MichaelChirico
Created February 25, 2021 04:07
Show Gist options
  • Save MichaelChirico/0c49f6ea73f4d750590547eddb3dc0e3 to your computer and use it in GitHub Desktop.
Save MichaelChirico/0c49f6ea73f4d750590547eddb3dc0e3 to your computer and use it in GitHub Desktop.
Generate the travel radius around California Santa Clara County for COVID restrictions
library(data.table)
library(sp)
library(rgdal)
library(rgeos)
# Via CA GIS Data site
ca = readOGR("~/Downloads/CA_Counties", "CA_Counties_TIGER2016")
travel_zone = gBuffer(
ca[ca$NAME == "Santa Clara", ],
width = 150 * 5280 * 12 * 2.54 / 100
)
travel_zone = gIntersection(travel_zone, ca)
plot(travel_zone, col = "red")
plot(ca, col = "#0064007f", add = TRUE)
text(coordinates(ca), ca$NAME, cex = .6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment