Learn R Programming

movecost (version 3.0.0)

mc_corridor: Least-cost corridor between locations

Description

Computes the least-cost corridor between point locations, that is, the band of terrain within which movement between the locations is comparatively cheap. The corridor is built from accumulated cost surfaces produced by the reused mc_surface graph. Two formulations are offered through the method argument; they coincide for isotropic cost functions and differ only when the cost function is anisotropic (direction-dependent, for instance the Tobler hiking function).

Usage

mc_corridor(
  surface,
  a,
  b = NULL,
  method = c("reach", "through"),
  lcp = TRUE,
  rescale = FALSE,
  time = "h"
)

Value

An object of class movecost_corridor, a list with components

  • corridor: the corridor surface (SpatRaster);

  • corridors: for more than two locations, a list of the individual pairwise corridor surfaces (NULL for the two-location case);

  • locations: the input locations (sf);

  • lcp.AtoB, lcp.BtoA: the two least-cost paths (sf lines with cost and length) for the two-location case with lcp = TRUE, else NULL;

  • lcp.cost: for method = "through" on two locations, the A-to-B least-cost-path cost (equal to the corridor minimum); NULL otherwise;

  • method: the formulation used;

  • metadata used by the plot method.

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

Arguments

surface

a movecost_surface object created by mc_surface.

a

first location, or (if b is NULL) a set of locations between whose unique pairs corridors are computed and summed (sf points, SpatVector, or legacy SpatialPointsDataFrame).

b

second location (same accepted classes); NULL by default.

method

"reach" (default) for the classic symmetric corridor (sum of two outward accumulated surfaces), or "through" for the directional A-to-B near-optimal-route band (see Details).

lcp

TRUE (default) or FALSE: when exactly two locations are supplied, also compute the least-cost paths A-to-B and B-to-A and overlay them on the plot. Ignored when more than two locations are supplied.

rescale

TRUE or FALSE (default): rescale the corridor values to the 0-1 range (useful for comparing corridors computed with different cost functions).

time

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

Details

method = "reach" (default; the classic least-cost corridor):
for every cell x the value is \(cost(A \to x) + cost(B \to x)\), the sum of the accumulated cost spreading outward from each location. This is the definition used in the GIS literature and in movecost <= 2.x: "the cost of a cell is the total cost to reach it from all the analysed locations" (Mitchell A. 2012, The ESRI Guide to GIS Analysis, Vol. 3, Esri Press, 257-259). The surface is symmetric in A and B, so it describes a direction-free corridor (a band of ground that is cheap to reach from both endpoints), which matches the usual conception of a corridor as bidirectional. Use this for the standard corridor analysis, for reproducibility against movecost <= 2.x and other GIS tools, and whenever the corridor is conceived as a two-way swath between places.

method = "through" (directional, near-optimal-route band):
for every cell x the value is \(cost(A \to x) + cost(x \to B)\), the cost of a journey from A to B that is constrained to pass through x (the second term is computed on the reversed graph). The minimum of this surface equals exactly the cost of the least-cost path from A to B, and cells whose value is within a chosen tolerance of that minimum form the band of near-optimal A-to-B routes. Unlike "reach", this surface is direction-specific: the (A, B) corridor differs from the (B, A) corridor under anisotropic costs. Use this when the interest is explicitly in one-way journeys from A to B and in identifying routes close to the optimal one in cost terms.

Why the two can differ: with an anisotropic cost function the cost of moving from B to x is not the cost of moving from x to B. The "reach" surface adds two outward ("from") costs and is symmetric; the "through" surface adds an outward and an inward cost and is directional. For symmetric (isotropic) cost functions the two are identical. As a concrete illustration, on sloped terrain with A low and B high the minimum of the "reach" surface corresponds to the cheaper of the two one-way trips (typically the downhill direction), whereas the minimum of the "through" surface is exactly the A-to-B (uphill) least-cost-path cost.

Least-cost path overlay: when exactly two locations are supplied (a and b) and lcp = TRUE (default), the least-cost paths from A to B and from B to A are also computed and returned, and are drawn over the corridor by the plot method, as in movecost <= 2.x. The two paths differ under anisotropic costs.

More than two locations: if a set of locations is supplied via a (with b left NULL), corridors are computed between all unique pairs and summed, as in movecost <= 2.x; the individual pairwise corridors are also returned. The accumulated surfaces are obtained from one multi-source graph query ("reach") or two ("through"), rather than two per pair. No least-cost paths are overlaid in this case.

References

Mitchell, A. (2012). The ESRI Guide to GIS Analysis. Vol. 3: Modelling Suitability, Movement, and Interaction. New York: Esri Press, 257-259.

See Also

mc_surface, plot.movecost_corridor, mc_paths

Examples

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

surf <- mc_surface(dtm, funct = "t", move = 8)

# classic (symmetric) least-cost corridor, with the two LCPs overlaid
corr <- mc_corridor(surf, a = destin[1, ], b = destin[4, ])
plot(corr)

# directional A-to-B near-optimal-route band
corr2 <- mc_corridor(surf, a = destin[1, ], b = destin[4, ], method = "through")
plot(corr2)

Run the code above in your browser using DataLab