Compute a raster file with the distances to the nearest vector feature, within the limits of a given mask.

distance_to_vector(x, mask)

Arguments

x

Spatial* object

mask

Raster* object

Value

Raster* object. Distance map in meters (even for unprojected maps in geographical coordinates).

Details

The resolution of the mask determines that of the outcome.

Examples

cmr <- mapMCDA_datasets() dist_wb <- distance_to_vector(cmr$water_bodies, cmr$animal.density) raster::plot(dist_wb)