WorldPop, which was initiated in 2013, offers easy access to spatial demographic datasets, claiming to use peer-reviewed and fully transparent methods to create global mosaics for the years 2000 to 2020. This function allows to efficiently calculate population count statistics (e.g. total number of population) for polygons. For each polygon, the desired statistic/s (min, max, sum, mean, median, sd or var) is/are returned.
calc_population_count(engine = "extract", stats = "sum")
A function that returns an indicator tibble with the specified populations statistics as variable and the corresponding values as value.
The preferred processing functions from either one of "zonal", "extract" or "exactextract" as character.
Function to be applied to compute statistics for polygons either one or multiple inputs as character "min", "max", "sum", "mean", "median" "sd" or "var".
The required resources for this indicator are:
worldpop
# \dontshow{
mapme.biodiversity:::.copy_resource_dir(file.path(tempdir(), "mapme-data"))
# }
if (FALSE) {
library(sf)
library(mapme.biodiversity)
outdir <- file.path(tempdir(), "mapme-data")
dir.create(outdir, showWarnings = FALSE)
mapme_options(
outdir = outdir,
verbose = FALSE
)
aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
package = "mapme.biodiversity"
) %>%
read_sf() %>%
get_resources(get_worldpop(years = 2010:2020)) %>%
calc_indicators(
calc_population_count(engine = "extract", stats = c("sum", "median"))
) %>%
portfolio_long()
aoi
}
Run the code above in your browser using DataLab