Skip to contents

Generate a spatial geometry from:

Usage

aoi_get(
  x = NULL,
  country = NULL,
  state = NULL,
  county = NULL,
  fip = NULL,
  zipcode = NULL,
  union = FALSE
)

Arguments

x

sf, or a Spat* object

country

character. Full name, ISO 3166-1 2 or 3 digit code. Not case sensitive. Data comes from Natural Earth.

state

character. Full name or two character abbreviation. Not case sensitive. If state = 'conus', the lower 48 states will be returned. If state = 'all', all states will be returned.

county

character. County name(s). Requires state input. Not case sensitive If 'all' then all counties in a state are returned

fip

a 2 or 5 digit US fip code

zipcode

a US zip code. Will return a centroid.

union

logical. If TRUE objects are unioned into a single object

Value

a sf geometry projected to EPSG:4326.

Examples

if (FALSE) {
# Get AOI for a country
aoi_get(country = "Brazil")
# Get AOI defined by a state(s)
aoi_get(state = "CA")
aoi_get(state = c("CA", "nevada"))

# Get AOI defined by all states, or the lower 48
aoi_get(state = "all")
aoi_get(state = "conus")

# Get AOI defined by state & county pair(s)
aoi_get(state = "California", county = "Santa Barbara")
aoi_get(state = "CA", county = c("Santa Barbara", "ventura"))

# Get AOI defined by state & all counties
aoi_get(state = "California", county = "all")
}