[FWTools] gdal_merge with nodata value

Frank Warmerdam warmerdam at pobox.com
Thu Oct 26 16:08:34 EDT 2006

Bryan Keith wrote:
> So I gave up on Windows and tried on linux with an old version of 
> FWTools (1.0.0a7) and an old version of gdal_merge.py (Revision 1.21), 
> and I got the same memory error that I ended up with on windows (albeit 
> much more quickly).  Now I'm thinking that specifying the nodata flag 
> does indeed use much more memory than without it and that I'll have to 
> bump up available memory to get these files to process.


The gdal_merge.py script does load the entire source image into memory.
If you use nodata values, it also creates multiple copies in memory as
it does the various operations.  So gdal_merge.py is really only appropriate
for modest sized input files.

Ideally you should be using gdalwarp.  It supports nodata values, can handle
a bunch of input files at once, and should not suffer these memory problems.

Unfortunately the arguments are non-trivially different than gdal_merge.py,
so you may need to do some fiddling about.

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    | President OSGeo, http://osgeo.org

More information about the FWTools mailing list