Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using gdal_retile to create ImagePyramid from a set of GeoTIFF images. I'm using following command:

gdal_retile.py -v -r bilinear -levels 8 -ps 2048 2048 -co "TILED=YES" -co "COMPRESS=JPEG" -targetDir F:/tiles --optfile F:/tileslist.txt

After couple of hours(source images are 320GB) I get following error message:

Traceback (most recent call last):
  File "C:\PROGRA~2\FWTOOL~1.7\bin\gdal_retile.py", line 940, in ?
    sys.exit(main(sys.argv))
  File "C:\PROGRA~2\FWTOOL~1.7\bin\gdal_retile.py", line 857, in main
    dsCreatedTileIndex = tileImage(minfo,ti)
  File "C:\PROGRA~2\FWTOOL~1.7\bin\gdal_retile.py", line 335, in tileImage
    createTile(minfo, offsetX, offsetY, width, height,tilename,OGRDS)
  File "C:\PROGRA~2\FWTOOL~1.7\bin\gdal_retile.py", line 467, in createTile
    dec.uly+offsetY*dec.scaleY)
  File "C:\PROGRA~2\FWTOOL~1.7\bin\gdal_retile.py", line 246, in getDataSet
    s_band = sourceDS.GetRasterBand( bandNr )
  File "C:\PROGRA~2\FWTOOL~1.7\pymod\gdal.py", line 654, in GetRasterBand
    raise ValueError, 'Out of range band requested: %d' % i
ValueError: Out of range band requested: 2

I tried to retile separately images that execution stops on, but then I get no error message. Everything works well, so my guess that it's something wrong with the source image doesn't seem to be valid.

Does anyone have any other ideas of what could be wrong or how I should troubleshoot the problem?

share|improve this question

1 Answer 1

Try running gdalinfo on the files that give you trouble, and the files that are ok, and looking at the number of bands. Quickly looking over the code, it looks like gdal_retile.py doesn't handle images with different numbers of bands.

If that's the case, you'll need to use gdal_translate to expand or repeat bands so all the files are the same depth.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.