[Gdal-dev] gdal_merge MemoryError

Frank Warmerdam fwarmerdam at gmail.com
Thu Aug 18 11:49:30 EDT 2005


On 8/18/05, michael buerge <mbu at endoxon.com> wrote:
> hi
> 
> I'm having problems joining several images using gdal_merge.
> Python throws me a MemoryError. The offending file (part2.tif) is fairly
> big (1GB), the error is caused as soon as gdal_merge tries to start
> copying from it so I'm assuming it is related to the size. The parts
> (part[0-3].tif) were created using gdal_translate.
> 
> beeing a newbie in using the gdal utilities (as well as python, for that
> matter) I'm pretty stuck and any pointers that help me solve this issue
> will be greatly appreciated.
> 
> system-info and the output of the command I'm trying to run are included
> below.

Michael, 

gdal_merge.py actually loads each input image into RAM before
writing out to the mosaic file so it is inappropriate to use for very
large images.

I would suggest you let gdal_merge.py create the output file, and 
then using gdalwarp with each input file to copy it into the
mosaic file.  The gdalwarp program uses the low level warp api
and does not depend on holding the whole image in memory.

Previously there was no well determined way to have gdal_merge.py
create the mosaic file, but not try to write to it, but I have added a 
new -createonly switch to gdal_merge.py.  You should be able to
grab this new version at:

  http://www.gdal.org/srctree/pymod/gdal_merge.py

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