Skip to contents

Adapted from seegSDM Identify closest neighbouring cell that does not return NA on raster mask

Usage

nearest_land(points, raster, max_distance)

Arguments

points

anything terra::extract() accepts as the y argument

raster

raster

max_distance

the map units if raster is projected

Value

matrix of XY coordinates of nearest cell on mask, or NAs