population_count | R Documentation |
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")
engine |
The preferred processing functions from either one of "zonal", "extract" or "exactextract" as character. |
stats |
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
A function that returns an indicator tibble with the specified populations statistics as variable and the corresponding values as value.
## Not run:
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
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.