[gdal-dev] Memory Error in _gdal.Band_ReadRaster(*args, **kwargs)

Paul Meems bontepaarden at gmail.com
Mon Aug 10 17:22:06 EDT 2009

I'm trying to split a large ECW file into smaller files.
I've downloaded and installed OSGeo4W with gdal16
I managed to split a small ecw file.
That ecw file had this info:

Driver: ECW/ERMapper Compressed Wavelets
Files: tilertest.ecw
Size is 6800, 7500
Coordinate System is `'
Origin = (13000.000000000000000,381250.000000000000000)
Pixel Size = (2.500000000000000,-2.500000000000000)
Corner Coordinates:
Upper Left  (   13000.000,  381250.000)
Lower Left  (   13000.000,  362500.000)
Upper Right (   30000.000,  381250.000)
Lower Right (   30000.000,  362500.000)
Center      (   21500.000,  371875.000)
Band 1 Block=6800x1 Type=Byte, ColorInterp=Red
  Overviews: arbitrary
Band 2 Block=6800x1 Type=Byte, ColorInterp=Green
  Overviews: arbitrary
Band 3 Block=6800x1 Type=Byte, ColorInterp=Blue
  Overviews: arbitrary

I used this statement:
gdal_retile -v -s_srs EPSG:28992 -of ECW -ps 3700 3750 -targetDir tiles

But when I try to split the large ecw file (3.4GB) I get an error after a
few minutes.
The info is:
Driver: ECW/ERMapper Compressed Wavelets
Files: Large.ecw
Size is 173334, 160000
Coordinate System is:
LOCAL_CS["LOCAL - (unsupported)",
Origin = (33000.000000000000000,381000.000000000000000)
Pixel Size = (0.150000000001455,-0.150000000023283)
Corner Coordinates:
Upper Left  (   33000.000,  381000.000)
Lower Left  (   33000.000,  357000.000)
Upper Right (   59000.100,  381000.000)
Lower Right (   59000.100,  357000.000)
Center      (   46000.050,  369000.000)
Band 1 Block=173334x1 Type=Byte, ColorInterp=Red
  Overviews: arbitrary
Band 2 Block=173334x1 Type=Byte, ColorInterp=Green
  Overviews: arbitrary
Band 3 Block=173334x1 Type=Byte, ColorInterp=Blue
  Overviews: arbitrary

The statement is:
gdal_retile -v -s_srs EPSG:28992 -of ECW -ps 86667 80000 -targetDir tiles
large.ecw >retile.txt

The logfile (retile.txt) shows:
Building internal Index for 1 tile(s) ... finished
Filename: Terneuzen_15cm.ecw
File Size: 173334x160000x3
Pixel Size: 0.150000 x -0.150000
UL:(33000.000000,381000.000000)   LR:(59000.100000,356999.999996)
tileWidth       86667
tileHeight      80000
countTilesX:    2
countTilesY:    2
lastTileWidth:  86667
lastTileHeight: 80000

And the error is:
Traceback (most recent call last):
  File "C:\OSGeo4W\apps\gdal-16\bin\gdal_retile.py", line 938, in <module>
  File "C:\OSGeo4W\apps\gdal-16\bin\gdal_retile.py", line 855, in main
dsCreatedTileIndex = tileImage(minfo,ti)
  File "C:\OSGeo4W\apps\gdal-16\bin\gdal_retile.py", line 335, in tileImage
createTile(minfo, offsetX, offsetY, width, height,tilename,OGRDS)
  File "C:\OSGeo4W\apps\gdal-16\bin\gdal_retile.py", line 467, in createTile
  File "C:\OSGeo4W\apps\gdal-16\bin\gdal_retile.py", line 250, in getDataSet
data = s_band.ReadRaster( readOffsetX,readOffsetY,readX,readY,
readX,readY,self.band_type )
  File "C:\OSGeo4W\apps\gdal-16\pymod\osgeo\gdal.py", line 760, in
ReadRaster return _gdal.Band_ReadRaster(*args, **kwargs) MemoryError

I've searched using Google and found a similar error:
http://article.gmane.org/gmane.comp.gis.gdal.devel/18936 and contacted
Sarah, but she's still having the problem.

Does anybody know how to solve this?

I run it on a Vista 64-Bit 4-core, with 8GB RAM. I'm getting the same error
on a WinXP sp3 2-core, with 2 GB RAM


Paul Meems
The Netherlands
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090810/c852d909/attachment.html

More information about the gdal-dev mailing list