get_shp_zip: Read a zipped shapefile

View source: R/get_shp_zip.R

get_shp_zipR Documentation

Read a zipped shapefile

Description

This function takes a path to a given shapefile from online or local directory, and returns a sf based data.frame to the R environment.

Usage

get_shp_zip(shp_url, web = TRUE)

Arguments

shp_url

A character path to a zipped shapefile, locally or online.

web

TRUE/FALSE, is the path a web URL or a local directory path

Value

Returns an sf data.frame.

Examples

# set up the parameters to use in function:
library(sf)
library(utils)
library(mapview)

# get a shapefile of all USGS gages in North America
shp_url <- "https://water.usgs.gov/GIS/dsdl/gagesII_9322_point_shapefile.zip"

gages2 <- get_shp_zip(shp_url)

# now plot
mapview::mapview(gages2)

ryanpeek/wateRshedTools documentation built on Jan. 6, 2023, 7:06 a.m.