Given a url to a shapefile in a compressed .zip file, download the file and unzip it into a folder in your working directory.

get_shp(url, folder = "shape")

Arguments

url

url to download a shapefile.

folder

what to name the new folder in your working directory containing the shapefile

Value

A folder in your working directory with the shapefile; filepaths are printed to the console.

Examples

# \donttest{
library(sf)
url <- "https://www2.census.gov/geo/tiger/GENZ2019/shp/cb_2019_us_state_20m.zip"
folder <- tempdir()
print(folder)
get_shp(url, folder)
states <- sf::st_read(folder)
head(states)
# }