Return cell number of the nearest data point available in the the raster layer

get_near_nona(x = x, y = y, x_cell = NULL)

Arguments

x

raster object (raster, rasterStack, rasterBrick or SpatRaster)

y

point as an sf, sp or SpatVector object

x_cell

cell id if already extracted, if not provide this will be computed

Value

a list of cell for all points. Point falling in NA cell are assigned to the nearest with a value within a range of 3 cell around the points. The sf of points with NA is provided and the distance to the nearest cell with a non NA value.

Details

This function links a raster cell id to each points and search for the nearest cell with data (not NA) if the points fall within a cell with NA.

Author

Reto Schmucki