get_shp: Download shapefiles

View source: R/convenience-functions.R

get_shpR Documentation

Download shapefiles

Description

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

Usage

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


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)


geostan documentation built on April 3, 2025, 10:04 p.m.