Split a Bounding Box into a Regular Grid of Polygon Tiles
split_bbox_into_tiles.RdGiven an input sf object, this function extracts its bounding box and
divides it into a regular grid of rectangular polygon tiles using a specified
number of columns and rows.
Valor
An sf object consisting of rectangular polygons covering the bounding box of the input.
Each polygon represents a tile in the grid. All geometries are valid.
Detalles
This is useful for spatially chunking large geometries to speed up operations like intersection or cropping, especially when used with spatial indexing.
Ejemplos
if (FALSE) { # \dontrun{
world <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
tiles <- split_bbox_into_tiles(world, ncols = 3, nrows = 3)
plot(st_geometry(world))
plot(st_geometry(tiles), add = TRUE, border = "red")
} # }