[gdal-dev] Merging tiff4 files
Even Rouault
even.rouault at mines-paris.org
Mon Sep 5 13:24:08 EDT 2011
Le lundi 05 septembre 2011 09:55:52, aperi2007 a écrit :
> Hi,
> I'm try-ing to merge some tiff4 raster.
>
> The call I'm using (thx Frank and Etienne) is these:
>
> python gdal_merge.py -o ../raster/raster_1.tif -n 0 -ot Byte -pct
> ../raster/raster_1/*.tif
> gdal_translate -co NBITS=1 -co COMPRESS=CCITTFAX4 -co TFW=YES
> ../raster/raster_1.tif ../raster/raster_2.tif
>
> I firstly merge they with gdal_merge.py and after I translate they in a
> CTTIFF4 1 bit color.
>
> On a little test it work very well.
>
> But when I apply it to all set of raster it give me this memory error.
>
> ------
>
> D:\_fusion_raster_bw\gdal64bit>python gdal_merge.py -o
> ../raster/livorno0.tif -n
> 0 -ot Byte -pct ../raster/livorno/*.tif
> 0...10Traceback (most recent call last):
> File "gdal_merge.py", line 513, in <module>
> sys.exit(main())
> File "gdal_merge.py", line 499, in main
> fi.copy_into( t_fh, band, band, nodata )
> File "gdal_merge.py", line 242, in copy_into
> nodata_arg )
> File "gdal_merge.py", line 62, in raster_copy
> nodata )
> File "gdal_merge.py", line 102, in raster_copy_with_nodata
> to_write = Numeric.choose( nodata_test, (data_src, data_dst) )
> File
> "C:\OSGeo4W\apps\Python25\lib\site-packages\numpy\core\fromnumeric.py", l
> ine 170, in choose
> return choose(choices, out=out, mode=mode)
> MemoryError
>
> ------
>
> I don't know if this is a know issue or a problem of python configuration.
>
> I'm working on a windows7 64 bit, and I'm using a gdal 64bit version.
Are you sure you are using a 64bit GDAL ? AFAIR, OSGeo4W is 32bit only.
Anyway, it is known that gdal_merge.py is limited by memory in the way it
operates. You might want to use gdalwarp or gdalbuildvrt in that case.
More information about the gdal-dev
mailing list