For COG format, you should use -co RESAMPLING=mode. gdalwarp's -r switch only applies to the full resolution warper resampling, not the overviews. TB
Le mer. 21 août 2024, 18:09, Justin Terry via gdal-dev < gdal-dev@lists.osgeo.org> a écrit : > Hi, > > > > I'm experiencing a strange issue I've never seen before where certain > resampling methods that should only include values in the original dataset, > like mode and nearest, are adding new values in the overviews. > > > > For example, the original raster contains the following values: > > > > [0, 1, 2, 4, 5, 8, 9, 10, 16, 17, 18, 20, 21, 32, 33, 34, 36, 37, > 40, 41, 42, 64, 65, 66, 68, 69, 72, 73, 74, 80, 81, 82, 84, 85] > > > > I resample it using the following command: > > > > gdalwarp dataset.tif dataset_cog.tif -of COG -co COMPRESS=LZW -r mode > > > > And when I look at overviews, I start these values, especially as it > downsamples further: > > [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, > 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, > 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, > 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, > 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91] > > I saw the same if I tried it with nearest resampling. Maybe I'm > misunderstanding, but I would think these resampling methods would retain > the original values, and not interpolate any in-between values. > > I'm using GDAL version 3.9.1 on Mac M3 from Homebrew. > > Thanks, > Justin > > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev