Expand description
Resampling kernels — the math that makes pyramid building and raster warp possible.
§API shape
Two layers of API:
- Point sampling (
sample_*): given a band + fractional(x, y)in source pixel space, return the resampled value. Used bywarpto map one output pixel to its source value. - Tile-to-tile (
resample_tile): given a whole sourceRasterTile+ target dimensions, return a newRasterTileresampled across all bands. Used bypyramidto downsample for overview levels.
§Kernels covered
ResamplingMethod::Nearest— fastest; preserves categorical values exactly. Use for landcover/classification.ResamplingMethod::Bilinear— 2×2 weighted average. The default for continuous imagery (DEMs, RGB photos).ResamplingMethod::Cubic— 4×4 cubic-convolution kernel. Sharper than bilinear at moderate extra cost.ResamplingMethod::Lanczos— 6×6 windowed-sinc. Highest quality; slowest. Used for final-output downsampling where artefacts matter.ResamplingMethod::Average— area-weighted mean. Best for building pyramid overviews of continuous data (preserves means under downsampling, unlike bilinear).ResamplingMethod::Mode— most-frequent value within target area. For categorical pyramid overviews.
Functions§
- resample_
tile - Resize a
RasterTileto new(target_width, target_height). Used by pyramid building and warp output preparation. - sample
- Sample one fractional
(x, y)frombandusing the chosen method.