theoPath_param: theoPath_param

Description Usage Arguments Details Value Author(s) Examples

View source: R/theoPath.R

Description

Theoretical Paths using cost functions defined by Herzog 2012 with additional cost parameter

Usage

1
theoPath_param(ras_ai, ras_para, con, method, theta, p, type = "c")

Arguments

ras_ai

RasterLayer, raster with elevation values

ras_para

RasterLayer, raster with additional values (visibility, friction costs, etc.)

con

data.frame, connections of a Delaunay triangulation as a result of function theo_del or your own method

method

chr, either "walk_i" for pedestrians or "drive_i" for vehicles. For further informations look up the respective functions

theta

numeric, parameter controls randomisation of walk. Lower values equal more exploration of the walker around the shortest path, while if theta approaches zero the walk becomes totally random

p

numeric, buffer zone around rWalk rasters, used in loop

type

chr, either "c" (default) for least-cost distances or "r" for random walks. As stated by J. van Etten, there is no analytical way as of now to decide for intermediate values of theta which type should be chosen. For further informations see ?gdistance::geoCorrection

Details

If there are no actual parts of a path network known, the 'theoPath_herzog_param' function can be used to reconstruct pathways based on randomised shortest paths connecting known regions with higher densities of sites, e.g. monuments. An underlying cost surface is created by using the cost functions defined by I. Herzog (2012) either for walking or driving. By supplying an additional parameter (visibility, friction costs, etc.), hypotheses on the influence of different variables can be tested. This function is a useful step in the evaluation of reconstructed paths.

Value

List, two RasterLayer with values of summed up expectations of single rWalk connections. The item param with 0.1x the influence of the supplied parameter and param_1000 with 100x the influence of the supplied parameter and 10x the value of theta.

Author(s)

Franziska Faupel <ffaupel@ufg.uni-kiel.de>

Oliver Nakoinz <oliver.nakoinz.i@gmail.com>

Hendrik Raese <h.raese@roots.uni-kiel.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
set.seed(123)

# Creating random test data 
testmatrix <- data.frame(
 x = abs(runif(100, 1000, 1500)), 
 y = abs(runif(100, 1000, 1500)))

# Calculate local centres of infrastructure from monument location
pd=25
sw=10
r=100
maxima <- localMax(df=testmatrix, r=r, sw=sw, pd=pd)

# Setting geographical frame
xmin    <- min(testmatrix$x)
xmax    <- max(testmatrix$x)
ymin    <- min(testmatrix$y)
ymax    <- max(testmatrix$y)
ext_ai <- raster::extent(xmin, xmax, ymin, ymax)

# Coordinates used to set frame corner for definition of the aspect ratio
sv <- (xmax-xmin)/(ymax-ymin)
rw     <- 5   # width of raster defined in m

# Definition of frame expansion and defining frame                              
rows  <- round((ymax-ymin)/rw, 0) + 1                                    
colums <- round((xmax-xmin)/rw, 0) + 1                                     
v <- cbind(1:(colums*rows))                                              
df <- data.frame(v)                                                         
gt      <- sp::GridTopology(c(xmin, ymin), c(rw, rw), c(colums, rows))
sgdf    <- sp::SpatialGridDataFrame(gt, df)

# Initialising observation window for theoretical connections
win <- spatstat::owin(c(xmin, xmax),c(ymin, ymax))

# calculating theoretical connections via delaunay triangulation
theo_con <- theo_del(maxima,win)

# Setting up an artificial elevation map with random values
emap <- sgdf
emap@data$v <- sample((50:56), length(emap@data$v), replace=TRUE)
ras_emap <- raster::raster(emap)

# Friction Raster for preferring lowlands:
para <- ras_emap
para@data@values[which(para@data@values <0 )] <- 0
para@data@values <- para@data@values/ max(para@data@values)
raster::plot(para)

# Run the function with chosen parameters for method, theta and p
theo_run <- theoPath_param(ras_ai=ras_emap, 
                           ras_para=para, 
                           method="drive_i",
                           theo_con[[1]], 
                           theta=0.001, 
                           p=5, 
                           type="r")

ISAAKiel/pathARR documentation built on Sept. 10, 2021, 7:54 a.m.