[gdal-dev] Overview resampling generating non-existant values
Justin Terry
Justin.Terry at wri.org
Wed Aug 21 10:19:57 PDT 2024
Aha, that resolved the issue, thanks!
From: thomas bonfort <thomas.bonfort at gmail.com>
Date: Wednesday, August 21, 2024 at 9:32 AM
To: Justin Terry <Justin.Terry at wri.org>
Cc: Gdal Dev <gdal-dev at lists.osgeo.org>
Subject: Re: [gdal-dev] Overview resampling generating non-existant values
You don't often get email from thomas.bonfort at gmail.com. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
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 at lists.osgeo.org<mailto:gdal-dev at 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 at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240821/85ac17bd/attachment-0001.htm>
More information about the gdal-dev
mailing list