Learn R Programming

movecost (version 3.0.0)

mc_alloc: Cost allocation (Thiessen-like polygons based on movement cost)

Description

Partitions the landscape into zones of pertinence, assigning each DTM cell to the origin location from which it can be reached at the smallest accumulated cost. The result is the cost-based analogue of Voronoi/Thiessen polygons.

Usage

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

Value

An object of class movecost_alloc, a list with components

  • alloc: allocation zones (SpatRaster; cell value = index of the prevailing origin);

  • zones: the same zones as polygons (sf) with an origin_id attribute;

  • accum.min: minimum accumulated cost across origins (SpatRaster);

  • isolines: isolines of accum.min (sf);

  • origin: the origin locations (sf);

  • metadata used by the plot method.

Plot it at any time with plot() (see plot.movecost_alloc).

Arguments

surface

a movecost_surface object created by mc_surface.

origin

origin location(s) (sf points, SpatVector, or legacy SpatialPointsDataFrame); at least two.

time

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

breaks

optional isoline interval for the minimum-cost surface; if NULL (default), one tenth of its range. Isolines are returned for optional display in the plot method.

Details

All the accumulated cost surfaces are obtained with a single multi-source graph query on the mc_surface object: with n origins, movecost <= 2.x performed n full conductance-matrix constructions plus n accumulation runs, whereas this implementation performs none of the former and one batched run of the latter, making allocation over many sites orders of magnitude faster.

See Also

mc_surface, plot.movecost_alloc

Examples

Run this code
dtm <- mc_volc()
destin <- mc_destin_loc()

surf <- mc_surface(dtm, funct = "t", move = 8)
al <- mc_alloc(surf, origin = destin)

plot(al)                    # allocation zones
plot(al, isolines = TRUE)   # with cost isolines overlaid

Run the code above in your browser using DataLab