[gdal-dev] Unexpected behavior with gdal_merge.py

Frank Warmerdam warmerdam at pobox.com
Fri Dec 19 14:21:40 EST 2008

Roger André wrote:
> Just a quick question to ask for an explanation regarding something I've 
> just seen in gdal_merge.py.  I have 6 tiles arranged in 2 columns, and 
> which I've mosaic'd together.  I was asked to re-register the tiles in 
> the 1st column by 1/2 a pixel SW.  I've done this, and in openev I can 
> see that the individual tiles are shifted SW, thereby causing a gap to 
> appear between the 2 columns.  All good, and what I expected.  However, 
> when I mosaic the tiles together with gdal_merge.py, there is no gap, 
> and it actually appears as though the tiles in the 2nd column have been 
> shifted to fill the gap.  Is this to be expected?  I've read that it is 
> possible to mosaic tiles together using gdalwarp, but I'm not sure how 
> to do this.  If I used gdalwarp instead, would I have the expected gap?


I don't have a precise answer to your question (lacking all sorts of
details).  I will note that gdal_merge is not savvy about subpixel
location issues.  It basically takes the top left and bottom right
corner of the input image and tries to map it to a pixel region on the
mosaic. In doing this is somewhat careless about subpixel rounding issues.

If you need precision, gdalwarp may be more appropriate.

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/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list