Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement different walking times #124

Closed
mpadge opened this issue Jan 6, 2020 · 2 comments
Closed

Implement different walking times #124

mpadge opened this issue Jan 6, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@mpadge
Copy link
Member

mpadge commented Jan 6, 2020

Currently uses Naismith's Rule, but i found out from this tweet by @michaeldorman about the movecost package which implements several alternative cost functions. Some of these could also be implemented.

@mpadge
Copy link
Member Author

mpadge commented Aug 24, 2022

Looks like this is really worth implementing, especially in the Tobler or Marquez-Perez versions, which appropriately penalise even flat walking compared with slightly downhill. The formulas all come directly from ?movecost::movecost.

tref <- 1
dz <- -20:20 / 100
cost0 <- tref * (1 + dz / 10) # current naismith implementation
cost1 <- tref / (6 * exp (-3.5 * abs (dz + 0.05)))
cost2 <- tref / (4.8 * exp (-5.3 * abs (dz * 0.7 + 0.03)))
cost3 <- tref / (1 / ((0.0277 * abs (dz) * 100) + 0.6115))

cost1 <- cost1 / min (cost1)
cost2 <- cost2 / min (cost2)
cost3 <- cost3 / min (cost3)

n <- length (dz)
dat <- data.frame (
    slope = rep (dz, 4),
    cost_fn = c (
        rep ("Naismith", n),
        rep ("Tobler", n),
        rep ("Marquez-Perez", n),
        rep ("Uriarte Gonzalez", n)),
    cost = c (cost0, cost1, cost2, cost3)
)
library (ggplot2)
ggplot (dat, aes (x = slope, y = cost, colour = cost_fn)) +
    geom_line ()

Created on 2022-08-24 with reprex v2.0.2

@mpadge mpadge closed this as completed in 68b52de Aug 24, 2022
@mpadge
Copy link
Member Author

mpadge commented Aug 24, 2022

That commit dropped Naismith in favour of Tobler. Exposing choices between the variants shown above would be highly unlikely to ever make a discernible difference, particularly as errors in interpolating elevation differences from a raster will always far outweight the kinds of minor differences between the functions shown above. This single improvement should be plenty sufficient to make walking times far more realistic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant