Skip to contents

Gets ecoregion data for a spatial grid or polygon

Usage

get_ecoregion(
  spatial_grid = NULL,
  raw = FALSE,
  type = "MEOW",
  antimeridian = NULL
)

Arguments

spatial_grid

sf or terra::rast() grid, e.g. created using get_grid(). Alternatively, if raw data is required, an sf polygon can be provided, e.g. created using get_boundary(), and set raw = TRUE.

raw

logical if TRUE, spatial_grid should be an sf 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 to TRUE, otherwise set to FALSE. If set to NULL (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:

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