Description Usage Arguments Examples
The igraph package is used to contruct a regular landscape graph and calculate the accumulated cost of movement from each starting coordinate to points in a cost raster.
1 |
costsurf |
Raster cost surface |
scoord |
matrix 2 column starting coordinate |
snode |
numeric starting node number |
geocorrect |
logical use gdistance::geoCorrection() on transition matrix? |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | dm <- as.matrix(read.delim(system.file("extdata/etherington20120code/cost-surface20x20.txt",
package = "irlgraph"), skip = 6, na.strings = "-9999", header = FALSE, sep = " "))
costsurf <- raster::raster(nrows=dim(dm)[1],ncols=dim(dm)[2],
resolution=1,xmn=0, xmx = dim(dm)[1], ymn = 0, ymx = dim(dm)[2])
#neccessary to set resolution
costsurf[] <- dm
scoord <- matrix(c(10.5, 10.5, 15.5, 15.5), ncol = 2, byrow = TRUE)
result <- gdist_acc(costsurf, scoord)
sp::plot(result[[1]]$result)
points(scoord[1,1], scoord[1,2])
sp::plot(result[[2]]$result)
points(scoord[2,1], scoord[2,2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.