This function generates a spatial rectangular grid from the slot boundary of an object of class prevR; function used in particular by the methods kde(), krige() and idw().

make.grid.prevR(object, nb.cells = 100, cell.size = NULL)

Arguments

object

object of class prevR.

nb.cells

number of cells on the longest side of the studied area (unused if cell.size is defined).

cell.size

size of each cell (in the unit of the projection).

Value

Object of class sf::sfc (simple feature geometry list column).

Details

This function generates a spatial rectangular grid, each cell corresponding to the center of a square of side cell.size. If cell.size is not defined, side of cells will be calculated as the longest side of the slot boundary of object divided by nb.cells.

Examples

make.grid.prevR(fdhs)
#> Geometry set for 9100 features 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -5.467429 ymin: 4.788452 xmax: 3.800214 ymax: 15.03086
#> Geodetic CRS:  +proj=longlat +datum=WGS84
#> First 5 geometries:
#> POINT (-5.467429 4.788452)
#> POINT (-5.364455 4.788452)
#> POINT (-5.261481 4.788452)
#> POINT (-5.158508 4.788452)
#> POINT (-5.055534 4.788452)
make.grid.prevR(fdhs, nb.cells = 200)
#> Geometry set for 36400 features 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -5.493173 ymin: 4.762588 xmax: 3.825958 ymax: 15.05673
#> Geodetic CRS:  +proj=longlat +datum=WGS84
#> First 5 geometries:
#> POINT (-5.493173 4.762588)
#> POINT (-5.441686 4.762588)
#> POINT (-5.390199 4.762588)
#> POINT (-5.338712 4.762588)
#> POINT (-5.287225 4.762588)