Skip to contents

This is a wrapper of `get_bathymetry()`, `get_seamounts_buffered()`, `get_knolls()`, `get_geomorphology()`, `get_coral_habitat()`, and `get_enviro_zones()`. See the individual functions for details.

Usage

get_features(
  spatial_grid = NULL,
  raw = FALSE,
  features = c("bathymetry", "seamounts", "knolls", "geomorphology", "corals",
    "enviro_zones"),
  seamount_buffer = 30000,
  antipatharia_threshold = 22,
  octocoral_threshold = 2,
  enviro_clusters = NULL,
  max_enviro_clusters = 6,
  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 feature data in that polygon(s) will be returned. Note that this will be a list object, since raster and `sf` data may be returned.

features

a vector of feature names, can include: "bathymetry", "seamounts", "knolls", "geomorphology", "corals", "enviro_zones"

seamount_buffer

`numeric`; the distance from the seamount peak to include in the output. Distance should be in the same units as the area_polygon or spatial_grid provided, use e.g. `sf::st_crs(spatial_grid, parameters = TRUE)$units_gdal` to check what units your planning grid or area polygon is in (works for raster as well as sf objects)

antipatharia_threshold

`numeric` between 0 and 100; the threshold value for habitat suitability for antipatharia corals to be considered present (default is 22, as defined in Yesson et al., 2017)

octocoral_threshold

`numeric` between 0 and 7; the threshold value for how many species (of 7) should be predicted present in an area for octocorals to be considered present (default is 2)

enviro_clusters

`numeric`; the number of environmental zones to cluster the data into - to be used when a clustering algorithm is not necessary (default is NULL)

max_enviro_clusters

`numeric`; the maximum number of environmental zones to try when using the clustering algorithm (default is 8)

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 `spatial_grid` spans the antimeridian and set this appropriately.

Value

If `raw = TRUE`, a list of feature data is returned (mixed raster and `sf` objects). If a `spatial_grid` is supplied, a multi-layer raster or `sf` object of gridded data is returned, depending on the `spatial_grid` format.

Examples

# Grab EEZ data first 
bermuda_eez <- get_boundary(name = "Bermuda")
# Get raw data for Bermuda's EEZ
raw_data <- get_features(spatial_grid = bermuda_eez, raw = TRUE)
#> Getting depth zones...
#> Bathymetry data already downloaded, loading data from: /tmp/RtmpCn5uGe/bathy_-68.92_-60.7_28.91_35.81.tif
#> Getting seamount data...
#> Getting knoll data...
#> Getting geomorphology data...
#> Getting coral data...
#> Getting environmental zones data... This could take several minutes

bermuda_crs <- '+proj=laea +lon_0=-64.8108333 +lat_0=32.3571917 +datum=WGS84 +units=m +no_defs'
# Get feature data in a spatial grid
bermuda_grid <- get_grid(boundary = bermuda_eez, crs = bermuda_crs, resolution = 20000)

#set seed for reproducibility in the get_enviro_zones() function
set.seed(500)
features_gridded <- get_features(spatial_grid = bermuda_grid)
#> Getting depth zones...
#> Downloaded and saved data chunk 1 of 1
#> Finished! Data successfully saved to /tmp/RtmpCn5uGe/bathy_-68.95_-60.67_28.9_35.8.tif
#> Getting seamount data...
#> Getting knoll data...
#> although coordinates are longitude/latitude, st_intersection assumes that they
#> are planar
#> Getting geomorphology data...
#> Getting coral data...
#> Getting environmental zones data... This could take several minutes
terra::plot(features_gridded)