[gdal-dev] gdal_merge on large files
Peder Axensten
peder at axensten.se
Thu Jan 28 03:13:14 EST 2010
I want to run gdal_merge (and another program I made, based on gdal_merge) on rather large files -- typically 3-7 Gbytes. Not surprisingly I run into problems. I'm not very experienced in Python, but am I right to assume that the error below probably is an indication on a size problem? What is the raster size restrictions in gdal/numpy?
If this is a size problem, I thought I'd modify gdal_merge to process big rasters by parts, probably stealing ideas from gdal_calc3 by Chris Yesson.
Sorry if I'm not very specific, I'd appreciate any ideas from you experienced guys.
Best regards,
Peder Axensten
Research engineer
Swedish University of Agricultural Sciences
Forest Resource Management
Remote Sensing Laboratory
mosaic$ gdal_merge.py -o test.img -n 65565 sverige_VolumeBirch.img sverige_VolumeBeech.img sverige_VolumeOak.img
ERROR 2: Invalid dimensions : 27989 x 62863
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 431, in <module>
fi.copy_into( t_fh, band, band, nodata )
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 228, in copy_into
nodata_arg )
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 48, in raster_copy
nodata )
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 84, in raster_copy_with_nodata
t_xsize, t_ysize )
File "/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/osgeo/gdal.py", line 835, in ReadAsArray
buf_xsize, buf_ysize, buf_obj )
File "/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/osgeo/gdal_array.py", line 140, in BandReadAsArray
ar = numpy.reshape(ar, [buf_ysize,buf_xsize])
File "/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/numpy/core/fromnumeric.py", line 152, in reshape
return reshape(newshape, order=order)
ValueError: total size of new array must be unchanged
More information about the gdal-dev
mailing list