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
)
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.
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).
String. Filter to subset bnd spatial layer.
String. Attribute in stunitco to output ('STATECD', 'STATENM', 'COUNTYFIPS').
String. Name of FIA research station to restrict states to ('RMRS','SRS','NCRS','NERS','PNWRS'). If NULL, all research stations are included.
String. States to subset boundary to.
Number. Percent overlap to include.
Logical. If TRUE, clips boundary to state/RS restrictions.
Logical. If TRUE, display intersecting boundaries.
Logical. If TRUE, save boundary to outfolder.
List. See help(savedata_options()) for a list of options. Only used when savebnd = TRUE.
A list containing states and state names that the boundary crosses, and boundary and attribute information for the intersecting boundary.
# 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"