agg_worldpop.Rd
This function is called by the agg_worldpop module and downloads data on population density for a single country from WorldPop
agg_worldpop(shape, country_code, method, resolution, year, async = FALSE)
sf. sf object containing the area of interest
character. ISO3 code of the country.
character. The method used to estimate population. Either Constrained
or Unconstrained
.
character. The resolution of the returned raster. Either 100m
or 1km
.
numeric. The year to obtain data for. Either 2000 to 2020 when method = Unconstrained
or only 2020 when method = Constrained
logical. Whether or not the function is being used asynchronously
a SpatRaster object when async
is FALSE
or a PackedSpatRaster
when async
is TRUE
.
x_min <- 9.47
x_max <- 9.63
y_min <- 47.05
y_max <- 47.27
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 <- disagapp::agg_worldpop(shape = shape,
country_code ="LIE",
method = "Constrained",
resolution = "1km",
year = 2020)