
Raster aggregation, resampling, zonal statistics, masks and distances
Source:R/RasterOps.R
RasterAggregate.RdRasterAggregate: block statistics as terra::aggregate
(partial edge blocks kept). RasterDisaggregate: nearest-value
split. RasterResample: bilinear or nearest values at points.
ZonalStatistics: statistic per zone. RasterMask: as
terra::mask. DistanceTransform: Euclidean distance to the
nearest non-NA cell. CostDistance: accumulated least cost
with 8 neighbours (mean friction times step length, the ArcGIS Cost
Distance and gdistance convention).
Usage
RasterAggregate(grid, fact, fun = "mean", na_rm = FALSE)
RasterDisaggregate(grid, fact)
RasterResample(grid, extent, new_x, new_y, method = "bilinear")
ZonalStatistics(grid, zones, fun = "mean")
RasterMask(grid, mask, maskvalue = NULL, inverse = FALSE)
DistanceTransform(grid, res = 1)
CostDistance(cost, sources, res = 1)Arguments
- grid, zones, mask, cost
Numeric matrices (row 1 = north).
- fact
Aggregation factor.
- fun
Statistic.
- na_rm
Drop
NAvalues.- extent
c(xmin, xmax, ymin, ymax)of the source grid.- new_x, new_y
Target coordinates.
- method
"bilinear"or"near".- maskvalue
Value treated as masked.
- inverse
Invert the mask.
- res
Cell size.
- sources
Two-column matrix of source (row, column) cells.