Skip to main content

pixel_coverage

Function pixel_coverage 

Source
pub fn pixel_coverage(
    polygons: &[Polygon],
    transform: &Affine,
    nrows: usize,
    ncols: usize,
) -> Array2<f32>
Expand description

Compute fractional pixel coverage for a list of polygons.

Each pixel of the nrows x ncols grid mapped by transform gets the fraction of its area covered by polygons: exterior rings add their area and holes subtract it. Polygons are assumed already unioned by the caller (the Python wrapper unions them first); any residual overlap is clipped to 1.0. Rings with fewer than three vertices are ignored. Rows are processed in parallel on the current Rayon thread pool.

ยงReturns

A 2D array of shape (nrows, ncols) with values in [0, 1].