[gdal-dev] gdal_retile not enough memory

Pierre hydrolithe at gmail.com
Thu Mar 25 08:08:20 PDT 2021


Hi,

I have a set of .jp2 files (orthophotos) which I want to use in Geoserver.
All the files are around 24,5 Go.

I transform all the .jp2 files in a .vrt :
gdalbuildvrt D:\ortho\ortho.vrt -srcnodata 255 -hidenodata
D:\ortho\2020\*.jp2

Then I launch a gdaladdo on the .vrt. The .ovr file created is around 11,9
Go :
gdaladdo --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW
YCBCR --config INTERLEAVE_OVERVIEW PIXEL -r average D:\ortho\ortho.vrt 2 4
8 16 32 64

At the step of gdal_retile, I launch this command in GDAL 2.4.4 :
python gdal_retile.py -v -r bilinear -levels 4 -ps 2500 2500 -co
"COMPRESS=JPEG" -co "TILED=YES" -targetDir D:\ortho\tiles
D:\ortho\ortho.vrt

The program runs well (20440 tiles created) till an error message appears :
ERROR 1: Not enough memory to decode tile

ERROR 1: opj_decode() failed
ERROR 1:
D:\Donnees\bd_ortho\2020\25cm\07-2020-0785-6420-LA93-0M20-E080.jp2, band 1:
IReadBlock failed at X offset 0, Y offset 0: opj_decode() failed
D:\Donnees\bd_ortho\2020\25cm\07-2020-0785-6420-LA93-0M20-E080.jp2, band 1:
IReadBlock failed at X offset 0, Y offset 0: opj_decode() failed
Traceback (most recent call last):
File "gdal_retile.py", line 1022, in <module>
sys.exit(main(sys.argv))
File "gdal_retile.py", line 929, in main
dsCreatedTileIndex = tileImage(minfo, ti)
File "gdal_retile.py", line 358, in tileImage
createTile(minfo, offsetX, offsetY, width, height, tilename, OGRDS)
File "gdal_retile.py", line 502, in createTile
dec.uly + offsetY * dec.scaleY)
File "gdal_retile.py", line 269, in getDataSet
t_band.WriteRaster(tw_xoff, tw_yoff, tw_xsize, twysize, data)
File
"C:\Users\SIG-Pierre\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\gdal.py",
line 2381, in Write Raster
return _gdal.Band_WriteRaster(self, *args, **kwargs)
TypeError: not a unicode string or a bytes

My computer is on Windows 10 (20H2), Intel core i7 and 16 Gb RAM.

Is there a problem with my computer (not enough RAM as the error message
says) or is there a problem in my "gdal_retile" command ? I am listening if
you have some advices.

Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210325/eb60cded/attachment.html>


More information about the gdal-dev mailing list