build_id_raster: Build ID raster

View source: R/build_id_raster.R

build_id_rasterR Documentation

Build ID raster

Description

Build an ID raster matching the extent of a vector dataset

Usage

build_id_raster(polygons, template_raster = NULL)

Arguments

polygons

terra::SpatVector object. The polygons to be aggregated to

template_raster

(optional) terra::SpatRaster object. The template raster should contain and have the same CRS as the polygons. If template raster is NULL, the default, uses the default world template raster from make_world_template_raster().

Details

The ID raster will be used to build the aggregation table. Each pixel has a unique integer value from 1 to the number of pixels in the ID raster.

Value

ID raster. A terra::SpatRaster object that minimally encloses the polygons

Examples

## Not run: 
  polygons <- sf::st_read(system.file('extdata/Benin_communes.gpkg', package = 'mbg'))
  build_id_raster(polygons)

## End(Not run)

mbg documentation built on April 4, 2025, 2:06 a.m.