distance_map.Rd
Returns a distance map (in meters) to spatial features.
distance_map(x, boundaries, res = resolution(boundaries, max_ncells = 100))
sf or sfc object with relevant spatial features.
sf or sfc POLYGON object with administrative borders, or SpatRaster object from where to pick the resolution.
numeric. Resolution for the outcome distance map. The default divides the smallest dimension into 100 cells.
A raster map with distances in meters to the closest spatial feature.
Distances are computed up to the given boundaries and at given resolution.
cmr <- mapMCDA_datasets()
plot(distance_map(x = cmr$water_bodies, boundaries = cmr$cmr_admin3))
#>
|---------|---------|---------|---------|
=========================================