Skip to contents

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. The required resources for this indicator are:

Format

A tibble with a column for population count statistics

Details

The following arguments can be set:

stats_popcount

Function to be applied to compute statistics for polygons either one or multiple inputs as character. Supported statistics are: "mean", "median", "sd", "min", "max", "sum" "var".

engine

The preferred processing functions from either one of "zonal", "extract" or "exactextract" as character.

Examples

# \dontshow{
mapme.biodiversity:::.copy_resource_dir(file.path(tempdir(), "mapme-data"))
# }
# \dontrun{
library(sf)
library(mapme.biodiversity)

outdir <- file.path(tempdir(), "mapme-data")
dir.create(outdir, showWarnings = FALSE)

aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
  package = "mapme.biodiversity"
) %>%
  read_sf() %>%
  init_portfolio(
    years = 2000:2010,
    outdir = outdir,
    tmpdir = tempdir(),
    verbose = FALSE
  ) %>%
  get_resources("worldpop") %>%
  calc_indicators("population_count", stats_popcount = c("sum", "median"), engine = "extract") %>%
  tidyr::unnest(population_count)

aoi
#> Simple feature collection with 11 features and 8 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -71.80933 ymin: 18.57668 xmax: -71.33201 ymax: 18.69931
#> Geodetic CRS:  WGS 84
#> # A tibble: 11 × 9
#>    WDPAID NAME        DESIG_ENG ISO3  assetid popcount_sum popcount_median year 
#>     <dbl> <chr>       <chr>     <chr>   <int>        <dbl>           <dbl> <chr>
#>  1 478140 Sierra de … National… DOM         1        3941.            13.5 2000 
#>  2 478140 Sierra de … National… DOM         1        3786.            13.1 2001 
#>  3 478140 Sierra de … National… DOM         1        4012.            14.4 2002 
#>  4 478140 Sierra de … National… DOM         1        4083.            14.8 2003 
#>  5 478140 Sierra de … National… DOM         1        4336.            15.3 2004 
#>  6 478140 Sierra de … National… DOM         1        4323.            15.3 2005 
#>  7 478140 Sierra de … National… DOM         1        4569.            16.5 2006 
#>  8 478140 Sierra de … National… DOM         1        4339.            15.2 2007 
#>  9 478140 Sierra de … National… DOM         1        4784.            17.7 2008 
#> 10 478140 Sierra de … National… DOM         1        4923.            17.7 2009 
#> 11 478140 Sierra de … National… DOM         1        4016.            15.5 2010 
#> # ℹ 1 more variable: geom <POLYGON [°]>
# }