Learn R Programming

gdistance (version 1.1-2)

accCost: Accumulated Cost Surface

Description

Calculates the accumulated cost surface from one or more origins.

Usage

accCost(transition, fromCoords)

Arguments

transition
object of class TransitionLayer
fromCoords
origin point locations (SpatialPoints, matrix or numeric class)

Value

  • RasterLayer

Details

If more than one coordinate is supplied in fromCoords, the function calculates the minimum least-cost distance from any origin point. The function uses Dijkstra's algorithm (as implemented in the igraph package).

References

E.W. Dijkstra. 1959. A note on two problems in connexion with graphs. Numerische Mathematik 1, 269 - 271.

See Also

shortest.paths, geoCorrection, costDistance

Examples

Run this code
r <- raster(ncol=36,nrow=18)
r <- setValues(r,rep(1,times=ncell(r)))
tr <- transition(r, mean, directions=8)
tr <- geoCorrection(tr, type="c", multpl=FALSE)
cmd <- accCost(tr, c(0,0))

Run the code above in your browser using DataLab