[gdal-dev] gdal_merge on large files
Chaitanya kumar CH
chaitanya.ch at gmail.com
Thu Jan 28 13:17:05 EST 2010
Peder,
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.
Greg Coats' tiff file had tiles of 512 x 512 size.
Creating tiled tiffs is a good place to start. Use the -co TILED=YES option
in gdal_translate to create tiled tiffs.
Try Tim Sutton's page
http://linfiniti.com/2009/09/image-mosaicking-with-gdal/ on his experience
in image mosaicing.
On Thu, Jan 28, 2010 at 1:43 PM, Peder Axensten <peder at axensten.se> wrote:
> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9848167848
17.241582N 80.142635E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100128/b4c1fed8/attachment.html
More information about the gdal-dev
mailing list