[gdal-dev] Source pixels used when warping using cubic resampling

Even Rouault even.rouault at spatialys.com
Fri Nov 15 10:37:53 PST 2019


On vendredi 25 octobre 2019 16:02:57 CET Gregory, Matthew wrote:
> Hi all,
> 
> I am warping and upsampling an image from 4km to 30m using cubic resampling.
>  I've been warping different sized windows from the source image like this:
> 
> # Larger window
> gdalwarp
>   -t_srs EPSG:5070
>   -te -2303985 2406015 -2033985 2649015
>   -tr 30 30
>   -of GTiff
>   -r cubic
>   in.vrt
>   out.tif
> 
> # Single line of above window
> gdalwarp
>   -t_srs EPSG:5070
>   -te -2303985 2648985 -2033985 2649015
>   -tr 30 30
>   -of GTiff
>   -r cubic
>   in.vrt
>   line.tif
> 
> Naively, my expectation was that the overlap region would have identical
> values, but they don't.  I assume this means that the source (4km) pixels
> are being subset down to a smaller window before warping in the latter case
> that don't necessarily include the same 16 nearest pixels as in the first
> case?  I had a brief look through the Warp API tutorial and it looks like
> it may have something to do with the GDALSuggestedWarpOutput, but I didn't
> dig too deeply there.

maybe try to add

-et 0

and/or

-wo XSCALE=133.33333333333334 -wo YSCALE=133.33333333333334

where 133.3333 = 4000 / 30

XSCALE/YSCALE are "un-documented" there:
https://github.com/OSGeo/gdal/blob/master/gdal/alg/gdalwarpkernel.cpp#L1120


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list