Skip to contents

Grid centroids, grid area and number of grids

Usage

grid_pts_centroid(grid_size, dataset, bbox = NULL)

Arguments

grid_size

Number of grid cells per axis, or c(nx, ny).

dataset

Data frame with the columns x and y (if these are missing, the first two columns are used).

bbox

Optional bounding box c(xmin, xmax, ymin, ymax); the default is the data range.

Value

list(grid_points, grid_area, N, step, bbox); the first three elements keep the order of the original function. grid_points are the true centroids of the grid cells (x varying fastest).

Examples

toy <- denmark_toy_data()
geom <- grid_pts_centroid(grid_size = 10, dataset = toy)
c(grid_area = geom$grid_area, n_grids = geom$N)
#>   grid_area     n_grids 
#>   0.1299622 100.0000000