get_population_catchment.Rd
This function takes vectors of sampling site longitude and latitude and calculates the total population
residing within the drainage catchment of each coordinate pair. Raster data giving population counts per grid cell
and a Digital Elevation Model (DEM) are required. By default, the function delineates streams based on the
provided DEM. However, an optional shapefile (such as an urban sewer network) can be specified using the
path_stream_shp
argument and will be used instead of the natural stream network calculated from the DEM.
Note that the delineation of catchments along streams (or sewer networks) still depends on the directional flow
from the provided DEM. Intermediate spatial variables are written to the directory specified in path_output
.
get_population_catchment(
lon,
lat,
path_pop_raster,
path_dem_raster,
path_stream_shp = NULL,
path_output
)
A numeric vector giving the longitudes of the sampling sites in Decimal Degrees.
A numeric vector giving the latitudes of the sampling sites in Decimal Degrees.
The file path to a raster object providing population counts in each grid cell.
See download_worldpop_data
for methods to download population raster data.
The file path to a Digital Elevation Model (DEM) raster. See download_elevation_data
for methods to download DEM raster data.
An optional file path to a stream or sewer network shapefile. If NULL (the default), streams are delineated based on flow accumulation in the provided DEM.
The file path of an output directory where spatial data will be saved.
A data.frame
containing the catchment area and population counts for each sampling site.
if (FALSE) {
dir.create(file.path(getwd(), 'tmp'))
download_worldpop_data(iso3 = 'BGD',
year = 2020,
constrained = FALSE,
UN_adjusted = FALSE,
path_output = file.path(getwd(), 'tmp'))
download_elevation_data(lon = template_es_data$lon,
lat = template_es_data$lat,
path_output = file.path(getwd(), 'tmp'))
get_population_catchment(lon = template_es_data$lon,
lat = template_es_data$lat,
path_pop_raster = file.path(getwd(), 'tmp/bgd_ppp_2020.tif'),
path_dem_raster = file.path(getwd(), 'tmp/dem.tif'),
path_output = file.path(getwd(), 'tmp'))
}