par_pad_grid {chopin} | R Documentation |
Get a set of computational grids
Description
Using input points, the bounding box is split to the predefined numbers of columns and rows. Each grid will be buffered by the radius.
Usage
par_pad_grid(
input,
mode = c("grid", "grid_advanced", "grid_quantile"),
nx = 10L,
ny = 10L,
grid_min_features = 30L,
padding = NULL,
unit = NULL,
quantiles = NULL,
merge_max = NULL,
return_wkt = FALSE,
...
)
Arguments
input |
sf or Spat* object. |
mode |
character(1). Mode of region construction. One of
|
nx |
integer(1). The number of grids along x-axis. |
ny |
integer(1). The number of grids along y-axis. |
grid_min_features |
integer(1). A threshold to merging adjacent grids |
padding |
numeric(1). A extrusion factor to make buffer to clip actual datasets. Depending on the length unit of the CRS of input. |
unit |
character(1). The length unit for padding (optional).
|
quantiles |
numeric. Quantiles for |
merge_max |
integer(1). Maximum number of grids to merge per merged set. |
return_wkt |
logical(1). Return WKT format. When |
... |
arguments passed to the internal function |
Value
A list of two,
-
original
: exhaustive (filling completely) and non-overlapping grid polygons in the class of input -
padded
: a square buffer of each polygon inoriginal
. Used for computation.
Author(s)
Insang Song
See Also
Other Parallelization:
par_cut_coords()
,
par_grid()
,
par_grid_mirai()
,
par_hierarchy()
,
par_hierarchy_mirai()
,
par_make_grid()
,
par_merge_grid()
,
par_multirasters()
,
par_multirasters_mirai()
,
par_pad_balanced()
,
par_split_list()
Examples
lastpar <- par(mfrow = c(1, 1))
# data
library(sf)
options(sf_use_s2 = FALSE)
ncpath <- system.file("shape/nc.shp", package = "sf")
nc <- read_sf(ncpath)
nc <- st_transform(nc, "EPSG:5070")
# run: nx and ny should strictly be integers
nc_comp_region <-
par_pad_grid(
nc,
mode = "grid",
nx = 4L, ny = 2L,
padding = 10000)
par(mfcol = c(1, 2))
plot(nc_comp_region$original$geometry)
plot(nc_comp_region$padded$geometry)
nc_comp_region_wkt <-
par_pad_grid(
nc,
mode = "grid",
nx = 4L, ny = 2L,
padding = 10000,
return_wkt = TRUE)
nc_comp_region_wkt$original
nc_comp_region_wkt$padded
par(lastpar)