geo-registry

Resample Raster

The same raster on a grid with a different cell size, in the same CRS.

Pitfall. Nearest neighbour on continuous data keeps one cell's value per new cell; average gives the mean of the cells it covers.
Pitfall. Interpolating categorical data (land cover codes) with bilinear or cubic makes codes that do not exist.
About this operation
Also called Resample, change cell size, coarsen, aggregate cells, resize raster
Group raster/projection
Checks raster.resampling, raster.nodata
Pitfalls 2 listed above
Columbus tool Not stated
Notes Not stated
Status active
Broader Not stated
Narrower Not stated
Related

Parameters

Name Type Required Default Values Note
resolution number yes Not stated Not stated New cell size, in the raster's CRS units.
resampling enum no nearest nearest, bilinear, cubic, average, mode nearest or mode for categories; average to coarsen continuous data.

Inputs and outputs

Direction Name Type Geometry Note
Input raster raster Not stated Not stated
Output output raster Not stated Not stated

In each engine

Engine Tool Parameters Differences
gdal gdal raster reproject
  • resolution → resolution : x and y: --resolution 20,20.
  • resampling → resampling
  • raster → input
  • output → output
  • gdal raster resize does the same without reprojection support; without output-crs this keeps the raster's CRS.
gdal gdal raster resize
  • resolution → resolution : x and y: --resolution 20,20.
  • resampling → resampling
  • raster → input
  • output → output
None noted
grass r.resamp.stats
  • resolution Set by the computational region (g.region res=...).
  • resampling → method : average = average; mode = mode. not supported: nearest, bilinear, cubic
  • raster → input
  • output → output
  • For coarsening; r.resamp.interp interpolates and r.resample takes nearest neighbour.
grass r.resample
  • resolution Set by the computational region (g.region res=...).
  • resampling always nearest
  • raster → input
  • output → output
None noted
postgis-raster st_resample
  • resolution scalex and scaley (scaley negative for a north-up raster).
  • resampling → algorithm : nearest = NearestNeighbor; bilinear = Bilinear; cubic = Cubic. not supported: average, mode
  • raster → rast
None noted
qgis gdal:warpreproject
  • resolution → TARGET_RESOLUTION
  • resampling → RESAMPLING : nearest = 0; bilinear = 1; cubic = 2; average = 5; mode = 6
  • raster → INPUT
  • output → OUTPUT
  • The same tool reprojects; leaving TARGET_CRS empty keeps the raster's CRS.
terra terra::aggregate
  • resolution fact: how many cells to combine in each direction (2 doubles the cell size).
  • resampling → fun : average = mean; mode = modal. not supported: nearest, bilinear, cubic
  • raster → x
  • Only coarsens, by whole factors; disagg makes cells smaller. On a SpatVector, aggregate dissolves instead.
terra terra::resample
  • resolution y is a raster on the target grid; make one with rast(x) and res(r) <- value.
  • resampling → method : nearest = near; bilinear = bilinear; cubic = cubic; average = average; mode = mode
  • raster → x
None noted
whiteboxtools Resample
  • resolution → cell_size
  • resampling → method : nearest = nn; bilinear = bilinear; cubic = cc. not supported: average, mode
  • raster → inputs
  • output → output
  • Takes a list of inputs, which it also mosaics; base gives a raster whose grid to match.
xarray-spatial xrspatial.resample
  • resolution → target_resolution
  • resampling → method
  • raster → agg
  • scale_factor resizes by a factor instead of to a cell size.