traveltime() generates a travel time map based on the input facilities,
bounding box area, and travel mode.
See the friction() function for details on how the friction
layer is generated.
Usage
traveltime(
facilities,
bb_area,
mode = "walk",
dowscaling_model_type = "lm",
res_output = 100,
cache = FALSE,
file = NULL
)Arguments
- facilities
A
sfobject with the existing facilities.- bb_area
A
sfboundary box object with the area of interest.- mode
(optional) A
characterstring indicating the mode of transport. Options are"fastest"and"walk"(default ="walk").For
"fastest": The friction layer accounts for multiple modes of transport, including walking, cycling, driving, and public transport, and are based on the Malaria Atlas Project (2019) Global Travel Speed Friction Surface.For
"walk": The friction layer accounts only for walking speeds and is based on the Malaria Atlas Project (2015) Global Walking Only Friction Surface.
- dowscaling_model_type
(optional) A
characterstring indicating the type of model used for the spatial downscaling of the friction layer. Options are"lm"(linear model) and"rf"(random forest) (default:"lm").- res_output
(optional) A positive integerish number indicating the spatial resolution of the friction raster (and of the analysis), in meters. If the resolution is less than
1000, a spatial downscaling approach is used (default:100).- cache
(optional) A
logicalflag indicating whether to cache the downloaded friction data for future use (default:TRUE).- file
(optional) A
characterstring indicating the path to a local friction surface raster file. If provided, the function will use this file instead of downloading the friction data.
Value
An invisible list with the
following elements:
travel_time: ARasterLayerobject with the travel time map.friction: Alistwith the outputs of thefriction()function.
See also
Other travel time functions:
friction(),
traveltime_plot(),
traveltime_stats()
Examples
if (FALSE) { # \dontrun{
library(dplyr)
traveltime_data <-
naples_fountains |>
traveltime(
bb_area = naples_shape,
dowscaling_model_type = "lm",
mode = "walk",
res_output = 100
)
traveltime_data |> glimpse()
traveltime_data |>
traveltime_plot(
bb_area = naples_shape,
facilities = naples_fountains
)
} # }