Skip to contents

This function generates a regular rectangular grids and performs spatial sampling based on the provided data and parameters. The result from this function is similar to Generate Tessellation tool in ESRI's ArcGIS software but only square or rectangle polygons are possible. The extent of the point coordinates is divided into number of possible grids based on the values of cellsize. The cellsize is the length and width of polygon to be created. At this point spatial_quadgrid_sample and spatial_hexgrid_sampleare different function. The reason is because rotation of original data and resultant grid is possible for regular rectangular grids. In the future both functions can be merged together

Usage

spatial_quadgrid_sample(
  data,
  cellsize = c(10000, 10000),
  offset = c(0, 0),
  show_grid = TRUE,
  rotation_angle = NULL,
  fold_selection = "default",
  k = NULL
)

Arguments

data

The input data. It can be either an 'sf' object or a SpatialPoints object.

cellsize

The size of the grid cells, provided as a numeric vector with two values representing the x and y dimensions.

offset

The offset of the grid, provided as a numeric vector with two values representing the x and y offsets.

show_grid

Logical value indicating whether to display the quadgrid. Default is TRUE.

rotation_angle

The angle of rotation for the quadgrid. Default is NULL.

fold_selection

The method for fold selection. Options include "default", "systematic", or "random". Default is "default".

k

The number of folds for fold selection. Required when fold_selection is "systematic" or "random". Default is NULL.

Value

A list containing the plots (if 'show_grid' is TRUE), the quadgrid blocks (sf object), and the split objects.

Details

The spatial grid sample generates tessellation or fishnet in ESRI's ArcGIS software, Currently sp, sf and Vect data are allowed. The grid shows the number of samples within the grid and grid number e.g. (80,1). The default selection numbers the grids from bottom left and increases row wise. The random selection assigns the grid number randomly. The systematic grid numbering happens from bottom right and column wise.

The random selection as its' name applies select grids randomly, and systematic selection option allows to select the grids sequentially up to k

References

Pebesma, E., 2018. Simple Features for R: Standardized Support for Spatial Vector Data. The R Journal 10 (1), 439-446, https://doi.org/10.32614/RJ-2018-009