Open vincentsarago opened 3 years ago
min, max, med, sum are available only as warp resampling methods, and not overview ones. Warp resampling and overview resampling are different code paths. The reason is that overview resampling can be implemented in a more efficient way than warp resampling. So for each resampling method, work has to be done twice if we want it to be available from everywhere.
Thanks @rouault Just wanted to double check before I or someone start working on it 😀
I'd just like to throw in a hopeful comment that having min, max, med and sum in gdaladdo would be very useful :)
As far as I know the only supported methods are:
nearest applies a nearest neighbour (simple sampling) resampler
average computes the average of all non-NODATA contributing pixels. Starting with GDAL 3.1, this is a weighted average taking into account properly the weight of source pixels not contributing fully to the target pixel.
rms computes the root mean squared / quadratic mean of all non-NODATA contributing pixels (GDAL >= 3.3)
bilinear applies a bilinear convolution kernel.
gauss applies a Gaussian kernel before computing the overview, which can lead to better results than simple averaging in e.g case of sharp edges with high contrast or noisy patterns. The advised level values should be 2, 4, 8, ... so that a 3x3 resampling Gaussian kernel is selected.
cubic applies a cubic convolution kernel.
cubicspline applies a B-Spline convolution kernel.
lanczos applies a Lanczos windowed sinc convolution kernel.
average_magphase averages complex data in mag/phase space.
mode selects the value which appears most often of all the sampled points.
ref: https://gdal.org/programs/gdaladdo.html#cmdoption-gdaladdo-r
While those are more than enough for typical use case. I still think that having at least the
sum
method would be nice (especially if you havecount
data stored as COG. When creating overviews, in theory you would want thesum
of the counts instead of thenear
oraverage
.I haven't dug to much in the code and I'm not 💯 it's possible to add those methods.
🙏