5

I'm trying to mosaic the True Marble world imagery 250M geotiffs using gdal_merge.py though one of them doesn't have RGB bands like the rest and gdal_merge fails (same number of bands is listed as a requirement in it's documentation). This is the error I get:

python.exe : ERROR 5: TrueMarble.250m.21600x21600.B4.tif: GDALDataset::GetRasterBand(2) - Illegal band #

This is the tile causing the issue: TrueMarble.250m. 21600x21600.B4

Should I use a different mosaic tool or should I try to coerce the tile into the format gdal_merge requires somehow?

5

I ran across this mosaicing the True Marble imagery as well, though I used gdalbuildvrt and then gdal_translate. From memory, the recalcitrant tiffs are stored as a single band with a color table.

Just convert them to 3 band RGB with gdal_translate:

gdal_translate -expand rgb TrueMarble.250m.21600x21600.B4.tif TrueMarble.250m.21600x21600.B4.RGB.tif
  • That's it! thanks Luke :) I tried just gdal_translate in hopes that might do it but I wasn't aware of the -expand parameter :). btw +1 for use of the word recalcitrant :P – Andy Arismendi May 30 '13 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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