gdist_acc: Generate an accumulated cost surface using a regular...

Description Usage Arguments Examples

View source: R/gdist_acc.R

Description

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.

Usage

1
gdist_acc(costsurf, scoord = NULL, snode = NULL, geocorrect = TRUE)

Arguments

costsurf

Raster cost surface

scoord

matrix 2 column starting coordinate

snode

numeric starting node number

geocorrect

logical use gdistance::geoCorrection() on transition matrix?

Examples

 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])

jsta/irlgraph documentation built on May 20, 2019, 2:10 a.m.