Skip to contents

GridMaker: Builds a grid from a vector layer

Usage

GridMaker(
  layer = NULL,
  res = 100000L,
  epsg = 3035,
  tol = 0L,
  gt = c("SURF", "CPT"),
  tilesize = NULL,
  progress = FALSE,
  parallel = FALSE,
  ...
)

Arguments

layer

a simple feature (sf) containing the geometry of the region to be covered by the grid. if NULL the full extend of GridMaker under EPSG = 3035

res

100 000 The grid resolution (pixel size). The unit of measure is expected to be the same as the one of the CRS. Minimun value allowed 1

epsg

3035 (corresponding to ETRS89-LAEA) The EPSG numerical code of the grid CRS. Only proyected layers are allowed

tol

0 (buffer on layer) A tolerance distance to keep the cells that are not too far from the layer. This uses sf::st_buffer() before building the grid with default values. Negative tol is possible

gt

SURF The type of grid cell geometry: Squared surface representation ('SURF') or its centroid ('CPT').

tilesize

tile size if the computation has to be done using tiles (strongly recomended for big grids). tilesize is an scale factor so the eventual tile size = res*tilesize

progress

FALSE/TRUE show progress in case of tiling.

parallel

FALSE/TRUE in case of tiling, if the proccess should be run in parallel. Requires "future::plan(multisession, workers = ##)" outside the function.

...

Other parameters passed onto buffer if tol > 0.

Value

A sf grid layer object.

Examples

if (FALSE) { # \dontrun{

library(sf)
GridMaker()
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
GridMaker(nc, epsg = 32119)
GridMaker(nc, res = 1000L, epsg = 32119)

} # }