Skip to content

Instantly share code, notes, and snippets.

@bradlindblad
Last active March 1, 2019 15:26
Show Gist options
  • Save bradlindblad/8044f2b3100d3cbc7e64e4a496fff847 to your computer and use it in GitHub Desktop.
Save bradlindblad/8044f2b3100d3cbc7e64e4a496fff847 to your computer and use it in GitHub Desktop.
footprint_polygon
# To generate the footprint_polys data
footprint_poly <- function() {
#' Returns object of class SpatialPolygons of the AgC footprint.
#' Utilizes the Tigris:: package.
require(tidyverse)
require(tigris)
require(sf)
# Get County Polygons
states.raw <- tigris::states()
states <- states.raw[states.raw@data$STUSPS %in% c("CA", "OR", "WA"),]
states <- sf::st_as_sfc(states)
states <- sf::st_union(states)
states <- as(states, 'Spatial')
return(states)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment