convert_regions_to_grid {flexurba}R Documentation

Convert regions to a grid

Description

Convert the value of regions associated with a vector layer to a grid layer.

Usage

convert_regions_to_grid(regions, referencegrid, id = NULL)

Arguments

regions

character / object of class sf. Path to the vector layer with spatial regions, or an object of class sf with spatial regions

referencegrid

SpatRaster. Reference grid used to rasterize the values of the regions.

id

character. The column that contains the values of the regions. If NULL the first column is used.

Value

SpatRaster with the regions

Examples

# load data for urban proxies and regions
proxies <- load_proxies_belgium()
regions <- flexurba::units_belgium

# convert Belgian provinces ('GID_2') to a zonal grid
gridded_regions <- convert_regions_to_grid(regions, proxies$pop, "GID_2")
terra::plot(gridded_regions)

[Package flexurba version 0.2.2 Index]