spGetStates: Spatial wrapper - Extracts states that intersect a boundary.

View source: R/spGetStates.R

spGetStatesR Documentation

Spatial wrapper - Extracts states that intersect a boundary.

Description

Wrapper to get state names that intersect a given boundary.

Usage

spGetStates(
  bnd_layer,
  bnd_dsn = NULL,
  bnd.filter = NULL,
  stbnd.att = "COUNTYFIPS",
  RS = NULL,
  states = NULL,
  overlap = 1,
  showsteps = FALSE,
  savebnd = FALSE,
  savedata_opts = NULL
)

Arguments

bnd_layer

sf R object, Area of Interest (AOI) boundary. Can be a spatial sf object, full pathname to a shapefile, or name of a layer within a database.

bnd_dsn

String. Data source name (dsn; e.g., SQLite database or shapefile pathname) of bnd. The dsn varies by driver. See gdal OGR vector formats (https://www.gdal.org/ogr_formats.html).

bnd.filter

String. Filter to subset bnd spatial layer.

stbnd.att

String. Attribute in stunitco to output ('STATECD', 'STATENM', 'COUNTYFIPS').

RS

String. Name of FIA research station to restrict states to ('RMRS','SRS','NCRS','NERS','PNWRS'). If NULL, all research stations are included.

states

String. States to subset boundary to.

overlap

Number. Percent overlap to include.

showsteps

Logical. If yes, display intersecting boundaries.

savebnd

Logical. If yes, save boundary to outfolder.

savedata_opts

List. See help(savedata_options()) for a list of options. Only used when savebnd = TRUE.

Value

A list containing states and state names that the boundary crosses, and boundary and attribute information for the intersecting boundary.

Author(s)

Tracey S. Frescino

Examples

# Get polygon vector layer from FIESTA external data
WYbhdistfn <- system.file("extdata", 
                          "sp_data/WYbighorn_districtbnd.shp",
                          package = "FIESTA")

# Get intersecting statenames
spGetStates(WYbhdistfn)$statenames

# Get intersecting COUNTYFIP codes
spGetStates(WYbhdistfn,
            stbnd.att = "COUNTYFIPS")$states

FIESTA documentation built on Nov. 22, 2023, 1:07 a.m.