# Accumulated cost surface (Tobler's hiking function) ignoring slope using R gdistance?

Background

I wish to calculate in R the isochrones moving from a location outwards, implementing the Tobler's hiking function via the `gdistance` package (https://cran.r-project.org/web/packages/gdistance/vignettes/gdistance1.pdf). An example of the implementation is provided at the above link, pp. 14-46; please note that in that reference, the issue is approached from a slighlty different perspective, i.e. least-cost path between two locations A and B.

Issue

I can't understand why I get two different results usign the same code over two dataset (the one provided by the mentioned reference vs. my toy DTM). One result make intuitively sense, the other I believe is wrong.

Reproducible code

The code below is what I used for the two analyses. The first code uses a toy DTM which comes with the gdistance package itself. The dtm and point shapefile for the second analysis are available here:

https://www.dropbox.com/s/8t0fkuovehrsf0z/mydtm.rda?dl=0

https://www.dropbox.com/s/rlzclkzlv37v2v0/loc.rda?dl=0

Following the abovementioned source (with sligth modifications), I get the first (reasonable) result attached (1st and 2nd image):

``````dtm <- raster(system.file("external/maungawhau.grd", package="gdistance"))
altDiff <- function(x){x - x}
hd <- transition(dtm, altDiff, 8, symm=FALSE)
slope <- geoCorrection(hd)
speed <- slope
Conductance <- geoCorrection(speed)
A <- c(2667670, 6479000)
accum <- accCost(Conductance, A)
plot(dtm)
plot(accum)
points(A, A, pch=20)
``````

At the best of my understanding, the `accum` raster is (correctly, I think) representing the time it takes to move from the source location. Side note: I used the inverse of the Tobler's function to get time not speed).

Different story with my DTM (3rd and 4th image attached):

``````dtm <- mydtm
altDiff <- function(x){x - x}
hd <- transition(dtm, altDiff, 8, symm=FALSE)
slope <- geoCorrection(hd)