rasterize_polygons: Create a raster approximation of a polygon coverage

rasterize_polygonsR Documentation

Create a raster approximation of a polygon coverage

Description

Returns a raster whose values indicate the index of the polygon covering each cell. Where multiple polygons cover the same cell, the index of the polygon covering the greatest area will be used, with the lowest index returned in the case of ties. Cells that are not covered by any polygon, or whose total covered fraction is less than min_coverage, will be set to NA.

Usage

## S4 method for signature 'sf,RasterLayer'
rasterize_polygons(x, y, min_coverage = 0)

## S4 method for signature 'sf,SpatRaster'
rasterize_polygons(x, y, min_coverage = 0)

Arguments

x

a sf or sfc object with polygonal geometries

y

a (possibly empty) RasterLayer whose resolution and extent will be used for the generated RasterLayer.

min_coverage

minimum fraction of a cell that must be covered by polygons to be included in the output

Value

a RasterLayer or SpatRaster, consistent with the type of y


exactextractr documentation built on Sept. 20, 2023, 9:08 a.m.