Peder,<br>
<br>
The problem here is the lack of or very large tiles/blocks in the
image. BandReadAsArray() was asked to read a whole 27989 x 62863 block
into memory. That's 1.76 Giga pixels. Too big.<br>
<br>
Greg Coats' tiff file had tiles of 512 x 512 size.<br><br>Creating tiled tiffs is a good place to start. Use the -co TILED=YES option in gdal_translate to create tiled tiffs.<br><br>Try Tim Sutton's page <a href="http://linfiniti.com/2009/09/image-mosaicking-with-gdal/">http://linfiniti.com/2009/09/image-mosaicking-with-gdal/</a> on his experience in image mosaicing.<br>
<br><div class="gmail_quote">On Thu, Jan 28, 2010 at 1:43 PM, Peder Axensten <span dir="ltr"><<a href="mailto:peder@axensten.se">peder@axensten.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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?<br>
<br>
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.<br>
<br>
Sorry if I'm not very specific, I'd appreciate any ideas from you experienced guys.<br>
<br>
Best regards,<br>
<br>
Peder Axensten<br>
Research engineer<br>
<br>
Swedish University of Agricultural Sciences<br>
Forest Resource Management<br>
Remote Sensing Laboratory<br>
<br>
<br>
<br>
mosaic$ gdal_merge.py -o test.img -n 65565 sverige_VolumeBirch.img sverige_VolumeBeech.img sverige_VolumeOak.img<br>
ERROR 2: Invalid dimensions : 27989 x 62863<br>
Traceback (most recent call last):<br>
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 431, in <module><br>
fi.copy_into( t_fh, band, band, nodata )<br>
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 228, in copy_into<br>
nodata_arg )<br>
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 48, in raster_copy<br>
nodata )<br>
File "/Library/Frameworks/Python.framework/general-site-packages/gdal-tools/gdal_merge.py", line 84, in raster_copy_with_nodata<br>
t_xsize, t_ysize )<br>
File "/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/osgeo/gdal.py", line 835, in ReadAsArray<br>
buf_xsize, buf_ysize, buf_obj )<br>
File "/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/osgeo/gdal_array.py", line 140, in BandReadAsArray<br>
ar = numpy.reshape(ar, [buf_ysize,buf_xsize])<br>
File "/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/numpy/core/fromnumeric.py", line 152, in reshape<br>
return reshape(newshape, order=order)<br>
ValueError: total size of new array must be unchanged<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9848167848<br>17.241582N 80.142635E<br>