Finds and downloads WorldPop population counts for a country and year, for the whole population or for chosen age groups and sexes, and returns them as a single raster of people per cell.
Arguments
- country
ISO3 code of the country, for example
"LBR"for Liberia.- year
Year of the population estimates.
- ages
NULL(the default) for the whole population, or a vectorc(from, to)of ages in years, for examplec(20, Inf)for adults aged 20 and over orc(0, 4)for children under five. Both ends must match the WorldPop age groups (0, 1 to 4, 5 to 9, and so on in five-year groups, with an open-ended oldest group).- sex
"both"(the default),"female"or"male". Only used withages.- resolution
"100m"(the default) or"1km".- constrained
Logical.
FALSE(the default) uses the unconstrained estimates, which spread people over all land;TRUEuses the constrained estimates, which place people only in mapped settlements. See Details.- un_adjusted
Logical. If
TRUE, national totals are adjusted to match United Nations population estimates. Available for the whole population of the unconstrained 2000 to 2020 estimates.- dest_dir
Directory for the downloaded files. Files already there are not downloaded again. Defaults to a temporary directory.
- messages
Logical. Report the product and the number of files. Defaults to the option
RiskMap.messages, orTRUEif it is not set.
Details
WorldPop distributes census-based population totals over a fine grid with statistical models that use covariates such as settlement maps, roads and night-time lights. The products differ in how people are placed:
Unconstrained estimates (
constrained = FALSE) place people in every land cell, so sparsely populated or uninhabited areas receive small counts. They are available for every year from 2000 to 2020, at 100 m and 1 km, for the whole population and by age and sex. They suit population weights on grids of a few kilometres and analyses of past surveys.Constrained estimates (
constrained = TRUE) place people only in cells mapped as built-up settlements. They describe where people live more sharply, particularly at fine resolution, but can miss small rural settlements. This function uses the WorldPop release covering 2015 to 2030.
WorldPop also produces bottom-up estimates from microcensus surveys for a few countries, which this function does not cover.
The function queries the WorldPop catalogue at
https://hub.worldpop.org/rest/data, which needs the jsonlite package,
and downloads the files it lists. The 1 km age and sex layers of the
2000 to 2020 release are not listed in the catalogue, and their addresses
are built from WorldPop's naming pattern. When ages covers several age
groups or both sexes, their counts are added together.
The result is in longitude and latitude. To aggregate the counts to the
cells of a prediction grid, project them with terra::project() and
method = "sum", sum them into larger cells with terra::aggregate(),
and pass the result to create_grid() as raster.
References
WorldPop (www.worldpop.org). Please cite the WorldPop products used, as listed on the WorldPop website.
