[Gdal-dev] GDAL_MERGE Memory Error

Frank Warmerdam warmerdam at pobox.com
Fri Dec 2 16:27:55 EST 2005


On 12/2/05, Reinaldo Escada Chohfi <rec at geodesign.com.br> wrote:
>  Hello everyone,
>
>  I'm running gdal_merge.py and get the following memory allocation error
> when using the -n 0 flag:
>
>  Traceback (most recent call last):
>    File "gdal_merge.py", line 478, in ?
>      fi.copy_into( t_fh, band, band, nodata )
>    File "gdal_merge.py", line 288, in copy_into
>      nodata_arg )
>    File "gdal_merge.py", line 110, in raster_copy
>      nodata )
>    File "gdal_merge.py", line 147, in raster_copy_with_nodata
>      nodata_test = Numeric.equal(data_src,nodata)
>  MemoryError: can't allocate memory for array
>
>  I run the program twice using the same input datasets when making a mosaic
> to extract two images with the -n 0 flag.  I get one image out. However, I
> get the above error when trying to get the second image out.  I get the same
> error when trying to do the same operation on other inputs.  The output
> images are all the same size about 500 MB.
>
>  I'm running gdal_merge.py on a AMD 64-bit machine with 4 GB of RAM and lots
> of disk space.

Reinaldo,

I suspect that the 32bit FWTools binaries are not able
to utiltize your RAM effectively.  I suspect a 1 or 2GB
limit per process.  I would suggest instead that you
use gdal_merge.py to create the mosaic file, and then
use gdalwarp to merge in each file to the mosaic.   It
does not attempt to load whole images into RAM.

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