| extract_burn | R Documentation |
Queries the sparse tables directly; no dense matrix is created.
For points at cell centres this reproduces materialize_chunk()
exactly:
extract_burn(x, xy, fun) == materialize_chunk(x, fun)[cbind(row, col)]
extract_burn(x, xy, fun = c("id", "sum"))
x |
A |
xy |
A two-column matrix or data.frame of x, y coordinates in the CRS of the burn. |
fun |
character, |
Interior runs are matched by row equality plus column interval containment; edges, lines, and points by exact (row, col) match. Cost is O(points + hits), independent of grid dimension.
A numeric vector of length nrow(xy). Points outside the
grid extent are NA for both funs.
if (requireNamespace("geos", quietly = TRUE)) {
library(geos)
poly <- as_geos_geometry("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))")
r <- burn(poly, extent = c(0, 10, 0, 10), dimension = c(10L, 10L))
# value at three cell centres (fun = "id": geometry id, else NA)
extract_burn(r, cbind(c(1.5, 5.5, 8.5), c(1.5, 5.5, 8.5)), fun = "id")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.