Skip to contents

Calculates distance from shore for each grid cell in the provided spatial grid. Spatial grid can be terra::rast() or sf format. The Natural Earth high resolution land polygons are used as the coastline and are downloaded from the Natural Earth website (https://www.naturalearthdata.com/downloads/10m-physical-vectors/), so an internet connection is required.

Usage

get_dist_shore(spatial_grid, inverse = FALSE)

Arguments

spatial_grid

sf or terra::rast() grid, e.g. created using get_grid().

inverse

logical set to TRUE to get the inverse of distance to shore, i.e. highest values become lowest and vice versa. This is useful for use in spatial prioritization as a proxy for fishing activity, where the further a grid cell is from the shore, the less fishing activity there might be. Default is FALSE and returns distance from shore.

Value

a terra::rast or sf object (same type as spatial_grid input) with distance to shore for each grid cell.

Examples

# Get EEZ data first 
bermuda_eez <- get_boundary(name = "Bermuda")
# Get a raster spatial grid for Bermuda
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)
dist_from_shore_rast <- get_dist_shore(bermuda_grid)
terra::plot(dist_from_shore_rast)