This function is called by the cov_water module and downloads data on the distance to surface water from ArcGIS

cov_water(shape, token, async = FALSE)

Arguments

shape

sf. sf object containing the area of interest

token

httr2_token. ArcGIS access token. Click here to obtain yours and either provide that or set the ARCGIS_CLIENT and ARCGIS_SECRET environmental variables to automate it as explained here.

async

Whether or not the function is being used asynchronously. When TRUE the returned object is a wrapped SpatRaster.

Value

a SpatRaster object when async is FALSE or a PackedSpatRaster when async is TRUE.

Author

Simon Smart simon.smart@cantab.net

Examples

if (FALSE) { # \dontrun{
x_min <- 0
x_max <- 0.5
y_min <- 52
y_max <- 52.5
poly_matrix <- matrix(c(x_min, x_min, x_max, x_max, x_min,
                        y_min, y_max, y_max, y_min, y_min), ncol = 2)
poly <- sf::st_polygon(list(poly_matrix))
shape <- sf::st_sf(1, geometry = list(poly))
sf::st_crs(shape) = 4326
raster <- cov_water(shape = shape, token = arcgisutils::auth_client())
} # }