[gdal-dev] merging of files with gdalwarp causses a slight shift

Frank Warmerdam warmerdam at pobox.com
Tue Sep 6 23:23:08 EDT 2011


On 11-09-06 06:05 PM, Etienne Tourigny wrote:
> Hi All,
>
> Merging 2 files with a geographical CRS results in the output being shifted a
> quarter-pixel to the east and south.  The datum is WGS84 (altough not
> explicitly named), I get the same result if I explicitly set it to WGS84.
> SImilar data in modis sinusoidal projection gets merged fine with the same command.
>
> I am using the following command:
> gdalwarp -srcnodata 0 -dstnodata 0 -co COMPRESS=LZW
> MCD45monthly.burndate.Win06.2010-byte.tif
> MCD45monthly.burndate.Win05.2010-byte.tif MCD45monthly.burndate.sam.2010-Byte.tif
>
> Files can be found at:
> http://www.openclimgeo.org/pub/
>
>
> Any help would be appreciated! Here is the gdalinfo for the 3 files.

Etienne,

As far as I can see the two input files (Win05 and Win06) are not sampled
on the same grid even though they have the same pixel size.  For instance
comparing the offsets of the top left X positions we see they are not an
even number of pixels apart:

 >>> (-81.997802734374957 - -78.997802734374972) / 0.004394531250000
-682.66666666666345

When gdalwarp creates the output file it picks an extent and pixel size
to capture all the input files and preserve essentially the same pixel
size.  In this case the pixel size seems to be preserved but by definition
the sampling grid can't match both files so one ends up being resampled.

So, things are "working as intended".

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/warmerda
and watch the world go round - Rush    | Geospatial Software Developer



More information about the gdal-dev mailing list