Wrapper to get state names that intersect a given boundary.

spGetStates(
  bnd_layer,
  bnd_dsn = NULL,
  bnd.filter = NULL,
  stbnd.att = "COUNTYFIPS",
  RS = NULL,
  states = NULL,
  overlap = 1,
  clipbnd = FALSE,
  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.

clipbnd

Logical. If TRUE, clips boundary to state/RS restrictions.

showsteps

Logical. If TRUE, display intersecting boundaries.

savebnd

Logical. If TRUE, 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

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
#> boundary intersected the following states: Wyoming
#> [1] "Wyoming"

# Get intersecting COUNTYFIP codes
spGetStates(WYbhdistfn,
            stbnd.att = "COUNTYFIPS")$states
#> boundary intersected the following states: Wyoming
#> [1] "56003" "56019" "56033" "56043"