get_url_ply: Get polygon from link or NOAA Sanctuary code

View source: R/read.R

get_url_plyR Documentation

Get polygon from link or NOAA Sanctuary code

Description

Given a sanctuary code or link (ie URL), download the zip, unzip it, and read first shapefile as a spatial feature. This function was originally designed to pull from one of the zip links found at NOAA Sanctuaries GIS.

Usage

get_url_ply(
  sanctuary = NULL,
  url = NULL,
  dir_ply = here::here("data_ss/ply"),
  verbose = F
)

Arguments

sanctuary

NOAA Sanctuary code with which to form url. Sanctuary codes can be found at NOAA Sanctuaries GIS.

url

Link from which to fetch a polygon. Originally designed to pull from one of the zip links found at NOAA Sanctuaries GIS.

dir_ply

Directory to download locally into. This directory serves as a cache to skip operations if already performed. If zip file exists, skip downloading. If directory to unzip exists, skip unzipping.

verbose

Verbose messages describing operations and choices, such as skipping download or unzip and which shapefile used if more than one found.

Value

Returns a spatial feature sf polygon data frame.

Examples

# mbnms: Monterey Bay National Marine Sanctuary
ply_mbnms <- get_url_ply(sanctuary = "mbnms")
ply_mbnms
plot(ply_mbnms[1])

# fknms: Florida Keys National Marine Sanctuary
ply_fknms <- get_url_ply(sanctuary = "fknms")
ply_fknms
plot(ply_fknms[1])

marinebon/seascapeR documentation built on Nov. 13, 2024, 2:30 a.m.