cov_nightlight.Rd
This function is called by the cov_nightlight module and downloads annual
data on night time illumination from NASA (product ID VNP46A4) using the
blackmarbler package. You must obtain and a token from NASA to use this
function and set an environmental variable called NASA_bearer
to contain it.
It returns a SpatRaster for the selected area and year.
cov_nightlight(shape, year, bearer, async = FALSE)
sf. sf object containing the area of interest
numeric. Year for which to download the data. Limited to 2012-2022
character. NASA bearer token. Click here for details of how to obtain one.
Whether or not the function is being used asynchronously. When
TRUE
the returned object is a wrapped SpatRaster.
a SpatRaster object when async
is FALSE
or a PackedSpatRaster
when async
is TRUE
.
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_nightlight(shape = shape, year = 2022, bearer = Sys.getenv("NASA_bearer"))
} # }