Returns a distance map (in meters) to spatial features.

distance_map(x, boundaries, res = resolution(boundaries, max_ncells = 100))

Arguments

x

Spatial* object with relevant spatial features.

boundaries

SpatialPolygons* object with administrative borders, or Raster* object from where to pick the resoltion.

res

numeric. Resolution for the outcome distance map. The default divides the smallest dimension into 100 cells.

Value

A raster map with distances in meters to the closest spatial feature.

Details

Distances are computed up to the given boundaries and at given resolution.

Examples

cmr <- mapMCDA_datasets() raster::plot(distance_map(cmr$water_bodies, boundaries = cmr$cmr_admin3))
#> Warning: CRS object has comment, which is lost in output
#> Warning: CRS object has comment, which is lost in output