This function allows get_friction_surface()
to accept the argument extent
as a vector
, 2x2 matrix
, SpatVector
, or SpatRaster
and extracts and converts into the annoyingly specific format necessary to download the friction surface. See details in ?get_friction_surface
Examples
# vector/double
x <- c(111, 112, 0, 1)
ext_matrix(x)
#> min max
#> x 111 112
#> y 0 1
# SpatExtent
y <- terra::ext(x)
ext_matrix(y)
#> min max
#> x 111 112
#> y 0 1
# SpatRaster
r <- terra::rast(extent = y)
ext_matrix(r)
#> min max
#> x 111 112
#> y 0 1
# SpatVector
v <- terra::vect(y)
ext_matrix(v)
#> min max
#> x 111 112
#> y 0 1