Opened 18 years ago

Last modified 18 years ago

#1241 closed defect (fixed)

gdal_merge.py bogus error prevents creation of an output file

Reported by: gregcoats@… Owned by: warmerdam
Priority: highest Milestone:
Component: PythonBindings Version: unspecified
Severity: major Keywords:
Cc:

Description

Before doing all of the actual mosaicing, gdal_merge.py attempts to make sure that the output GeoTIF will be no larger than the largest legal size a TIF can be, which is 4 GB.  This is a good thing.  If gdal_merge.py detects that the output GeoTIF will be larger than 4 GB, it outputs an error message like this:

ERROR 1: A 42400 pixels x 32000 lines x 3 bands Byte image would be larger than 4GB
but this is the largest size a TIFF can be.  Creation failed.
Creation failed, terminating gdal_merge.

But 42,400 columns by 32,000 rows by 3 bands of byte imagery is only 3.79 GB.  So, this error message is bogus, apparently because line 3449 of gdal-1.3.2/frmts/gtiff/geotiff.cpp tells gdal_merge.py that 4 GB = 4,000,000,000 bytes, but that value is actually only 3.72 GB.  So, this line of code incorrectly limits the maximum size of the output GeoTIF to 3.72 GB, instead of limiting it to 4.0 GB = 4,294,967,296 bytes.
I suggest the value of 4,000,000,000 on line 3449 of gdal-1.3.2/frmts/gtiff/geotiff.cpp be increased to something closer to 4,294,967,296 bytes.

Change History (1)

comment:1 by warmerdam, 18 years ago

I deliberately chose a number smaller than 4GB so that there would be room for other stuff, like the tiff directory.  Currently there is no way to "in advance"
how much space the auxilary information will take. 

Nevertheless, the current 4000000000 limit leaves more room than needed.  I'll
change it to 4200000000 which still leaves roughly 90MB for auxilary info.

Note: See TracTickets for help on using tickets.