Calculate the travel time from a set of points over a friction surface.
Arguments
- friction_surface
A
SpatRaster
friction surface layer. See?get_friction_surface
- points
A two-column
matrix
,data.frame
, ortibble
with longitude (x) in the first column and latitude (y) in the second, or aSpatVector
, in the same coordinate, reference system asfriction_surface
.- filename
character
. Output file name with extension suitable forterra::writeRaster
- overwrite
logical
. IfTRUE
filename
is overwritten.
Details
Implements methods from Weiss et al. 2018, 2020 to calculate travel time from given locations over a friction surface.
Over large areas this function can require significant RAM and will be slow.
Citations: D. J. Weiss, A. Nelson, C. A. Vargas-Ruiz, K. Gligoric, S., Bavadekar, E. Gabrilovich, A. Bertozzi-Villa, J. Rozier, H. S. Gibson, T., Shekel, C. Kamath, A. Lieber, K. Schulman, Y. Shao, V. Qarkaxhija, A. K. Nandi, S. H. Keddie, S. Rumisha, P. Amratia, R. Arambepola, E. G. Chestnutt, J. J. Millar, T. L. Symons, E. Cameron, K. E. Battle, S. Bhatt, and P. W. Gething. Global maps of travel time to healthcare facilities. (2020) Nature Medicine. https://doi.org/10.1038/s41591-020-1059-1
D. J. Weiss, A. Nelson, H.S. Gibson, W. Temperley, S. Peedell, A. Lieber, M. Hancher, E. Poyart, S. Belchior, N. Fullman, B. Mappin, U. Dalrymple, J. Rozier, T.C.D. Lucas, R.E. Howes, L.S. Tusting, S.Y. Kang, E. Cameron, D. Bisanzio, K.E. Battle, S. Bhatt, and P.W. Gething. A global map of travel time to cities to assess inequalities in accessibility in 2015. (2018). Nature. doi:10.1038/nature25181.
Examples
ext <- matrix(
data = c("111", "0", "112", 1),
nrow = 2,
ncol = 2,
dimnames = list(
c("x", "y"),
c("min", "max")
)
)
friction_surface <- get_friction_surface(
surface = "motor2020",
extent = ext
)
#> Registered S3 methods overwritten by 'malariaAtlas':
#> method from
#> autoplot.SpatRaster tidyterra
#> autoplot.default ggplot2
#> Checking if the following Surface-Year combinations are available to download:
#>
#> DATASET ID YEAR
#> - Explorer__2020_motorized_friction_surface: DEFAULT
#>
#> Loading required package: sf
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is FALSE
#> No encoding supplied: defaulting to UTF-8.
#> <GMLEnvelope>
#> ....|-- lowerCorner: 0 111
#> ....|-- upperCorner: 1 112Start tag expected, '<' not found
from_here <- data.frame(
x = c(111.2, 111.9),
y = c(0.2, 0.35)
)
calculate_travel_time(
friction_surface = friction_surface,
points = from_here
)
#> class : SpatRaster
#> dimensions : 120, 120, 1 (nrow, ncol, nlyr)
#> resolution : 0.008333333, 0.008333333 (x, y)
#> extent : 111, 112, 0, 1 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> source(s) : memory
#> name : travel_time
#> min value : 0.0000
#> max value : 582.1882