Learn R Programming

movecost (version 3.0.0)

mc_accum: Accumulated cost surface and isolines around one or more origins

Description

Computes the anisotropic accumulated cost of movement around the input origin location(s), reusing the graph stored in a mc_surface object (nothing is recomputed). If more than one origin is supplied, the returned surface stores, for each cell, the minimum accumulated cost across origins (as in movecost <= 2.x).

Usage

mc_accum(surface, origin, time = "h", breaks = NULL)

Value

An object of class movecost_accum, a list with components

  • accum: accumulated cost surface (SpatRaster), masked to the DTM (NoData cells, e.g. sea, are NA);

  • isolines: contour lines (sf lines) with a level attribute;

  • origin: the origin location(s) (sf);

  • breaks, levels, time, funct, funct.label, cost.unit: metadata used by the plot method.

Plot it at any time, and as many times as desired, with plot() (see plot.movecost_accum); no computation is re-run.

Arguments

surface

a movecost_surface object created by mc_surface.

origin

origin location(s) (sf points, SpatVector, or legacy SpatialPointsDataFrame).

time

unit for time-based cost functions: "h" (hours, default) or "m" (minutes).

breaks

isoline interval; if NULL (default), one tenth of the range of accumulated values.

Details

Isolines (contour lines) are derived from the accumulated surface at an interval set by breaks; if no value is supplied, the interval defaults to one tenth of the range of the accumulated values.

For cost functions expressing cost as walking time, the accumulated values are returned in the unit selected via time ("h" hours, default, or "m" minutes); for the Pandolf, Pandolf-corrected, and Van Leusen functions, values are expressed in Megawatts; other functions keep their native unit (see mc_cost_functions).

See Also

mc_surface, plot.movecost_accum, mc_export

Examples

Run this code
dtm <- mc_volc()
start <- mc_volc_loc()

surf <- mc_surface(dtm, funct = "t", move = 8)
acc <- mc_accum(surf, origin = start, breaks = 0.05)

# \donttest{
plot(acc)                 # raster + isolines
plot(acc, type = "contour")  # isolines only
# }

Run the code above in your browser using DataLab