[FWTools] Size limit for opening TIFFs?

Frank Warmerdam warmerdam at pobox.com
Mon Feb 12 17:59:54 EST 2007


Jason Birch wrote:
> Seems like I'm just not going to get any joy today :)
> 
> Tried merging all but the largest files and got:
> 
> D:\Orthos>gdal_merge -o nanaimo.tif -n 255 -ps 1 1  -v
> Nanaimo_NE_2006_10cm.tif
> Nanaimo_NW_2006_10cm.tif Nanaimo_SE_2006_10cm.tif
> Nanaimo_SW_2006_10cm.tif
> 
> Filename: Nanaimo_NE_2006_10cm.tif
> File Size: 20000x21000x3
> Pixel Size: 0.500000 x -0.500000
> UL:(427000.000000,5455000.000000)   LR:(437000.000000,5444500.000000)
> Copy 0,0,20000,21000 to 8000,1500,10000,10500.
> Traceback (most recent call last):
>   File "C:\PROGRA~1\FWTOOL~1.1\bin\gdal_merge.py", line 503, in ?
>     fi.copy_into( t_fh, band, band, nodata )
>   File "C:\PROGRA~1\FWTOOL~1.1\bin\gdal_merge.py", line 303, in
> copy_into
>     nodata_arg )
>   File "C:\PROGRA~1\FWTOOL~1.1\bin\gdal_merge.py", line 125, in
> raster_copy
>     nodata )
>   File "C:\PROGRA~1\FWTOOL~1.1\bin\gdal_merge.py", line 162, in
> raster_copy_with
> _nodata
>     nodata_test = Numeric.equal(data_src,nodata)
> MemoryError: can't allocate memory for array
> 
> These are the files.  Their current cellsize is 0.5m.  Do I need to
> resample to 1m before doing the merge to avoid the 4GB limit?
> 
> 02/12/2007  11:18     1,260,526,905 Nanaimo_NE_2006_10cm.tif
> 02/12/2007  11:34     1,152,594,904 Nanaimo_NW_2006_10cm.tif
> 02/12/2007  11:15       864,450,627 Nanaimo_SE_2006_10cm.tif
> 02/12/2007  11:00       472,623,125 Nanaimo_SW_2006_10cm.tif

Jason,

You are running into a different problem.  gdal_merge.py reads each
input file completely into memory while working on it, so this doesn't
work well if individual input files are quite large, and >1GB counts
as large.

You can do something similar with gdalwarp.

gdalwarp -o nanaimo.tif -n 255 -tr 1 1 Nanaimo_NE_2006_10cm.tif \
    Nanaimo_NW_2006_10cm.tif Nanaimo_SE_2006_10cm.tif \
    Nanaimo_SW_2006_10cm.tif

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