R/burn_sparse.R
materialise_chunk.RdExpands a sparse burn_sparse() / burn_scanline() result into a dense
matrix, optionally over a subwindow of the parent grid. The matrix's
values depend on which kind of geometry produced the result:
materialise_chunk(
x,
target = NULL,
id = NULL,
type = c("matrix", "vector"),
max_cells = 1e+08
)a "controlledburn" object from burn_sparse() or burn_scanline()
numeric extent c(xmin, xmax, ymin, ymax) to materialise, or
NULL (default) for the full grid. The target extent is snapped outward to
cell boundaries of the source grid and clamped to the source extent.
integer geometry id (or vector of ids) to materialise, or NULL
(default) for all. Useful for filtering a mixed-kind result down to a
single kind before materialising.
character, one of "matrix" (default) or "vector"
maximum number of cells to allocate (default 1e8). Set to
Inf to disable the safety check.
A numeric matrix (nrow × ncol) or vector (length nrow*ncol).
The cell unit depends on geometry kind (see Description). When target
is specified, the matrix dimensions correspond to the snapped subwindow.
The snapped extent is available as attr(result, "extent").
Polygon ($runs + $edges): coverage fraction in [0, 1].
Interior cells are 1; boundary cells are the partial fraction.
Line ($lines): absolute length within each cell, in CRS units.
Multiple lines crossing the same cell sum.
Point ($points): integer count of points landing in each
cell. Multiple points in one cell sum.
If a result holds tables for more than one geometry kind (which can
happen when a single burn was given a mixed-kind input vector),
materialise_chunk() errors rather than silently combining different
units in one matrix. Filter with id = to one kind first, or run
separate burns for each kind.