Get ecoregions
get_ecoregion.Rd
Gets ecoregion data for a spatial grid or polygon
Arguments
- spatial_grid
sf
orterra::rast()
grid, e.g. created usingget_grid()
. Alternatively, if raw data is required, ansf
polygon can be provided, e.g. created usingget_boundary()
, and setraw = TRUE
.- raw
logical
if TRUE,spatial_grid
should be ansf
polygon, and the raw Ecoregion data in that polygon(s) will be returned (as opposed to gridded data)- type
character
which ecoregion type is required? Default is\"MEOW\"
(Marine Ecosystems of the World); other possible values are\"Longhurst\"
and\"LME\"
- antimeridian
Does
spatial_grid
span the antimeridian? If so, this should be set toTRUE
, otherwise set toFALSE
. If set toNULL
(default) the function will try to check if data spans the antimeridian and set this appropriately.
Value
For gridded data, a multi-layer raster object, or an sf
object depending on the spatial_grid
format. If raw = TRUE
an sf
object of the Ecoregion.
Details
The Following ecoregions can be obtained:
Marine Ecosystems of the World dataset
All data are downloaded via the mregions2
R package function mregions2::mrp_get()
, and more information on the data can be found on the Marine Regions website
Examples
#' # Get EEZ data first
bermuda_eez <- get_boundary(name = "Bermuda")
# Get Marine Ecoregions of the World data
ecoregions <- get_ecoregion(spatial_grid = bermuda_eez, raw = TRUE)
#> Spherical geometry (s2) switched off
#> although coordinates are longitude/latitude, st_intersection assumes that they
#> are planar
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
#> Spherical geometry (s2) switched on
# Get Longhurst Provinces in a spatial grid
bermuda_grid <- get_grid(boundary = bermuda_eez, crs = '+proj=laea +lon_0=-64.8108333 +lat_0=32.3571917 +datum=WGS84 +units=m +no_defs', resolution = 20000)
longhurst_gridded <- get_ecoregion(spatial_grid = bermuda_grid, type = "Longhurst")
#> Spherical geometry (s2) switched off
#> although coordinates are longitude/latitude, st_intersection assumes that they
#> are planar
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
#> Spherical geometry (s2) switched on