Skip to contents

raster_to_cell() covers the raster extent with DGGS cells, includes the neighboring edge cells needed for exact overlap, removes non-intersecting candidates, and extracts raster summaries. It returns no polygon geometry.

Usage

raster_to_cell(
  raster,
  resolution,
  grid = hex_grid(),
  fun = NULL,
  weights = "area",
  ...,
  max_cells = 100000L,
  progress = NULL,
  drop_na = TRUE
)

Arguments

raster

A terra::SpatRaster.

resolution

Target DGGS resolution.

grid

A modern grid from hex_grid().

fun, weights, ...

Extraction arguments passed to cell_extract().

max_cells

Hard maximum number of returned cells.

progress

Show progress where supported. NULL uses interactive defaults.

drop_na

Whether to remove cells for which every extracted raster summary is missing.

Value

A hex_data() object covering the raster extent.