[gdal-dev] Problem with gdal_translate : Illegal band #

Jean-Claude Repetto jrepetto at free.fr
Tue Mar 25 10:20:22 EDT 2008


Frank Warmerdam a écrit :
> Jean-Claude Repetto wrote:
>> mv COR_0000.TIF COR_0000.TIF.orig
>> pct2rgb.py COR_0000.TIF.orig COR_0000.TIF
>> gdal_translate -of ECW -co "TARGET=88" -co "DATUM=NTF"  -co 
>> "PROJ=LM2FRANC"  -co "LARGE_OK=YES" COR_0000.TIF COR_0000.ecw
>>
>> Input file size is 1200, 2200
>> Warning 6: '88' is an unexpected value for TARGET creation option of 
>> type float.
>> 0...10...20...30...40...50...60...70...80...90...100 - done.
>> ERROR 5: GDALDataset::GetRasterBand(2) - Illegal band #
>> ERROR 5: GDALDataset::GetRasterBand(3) - Illegal band #
> 
> Jean-Claude,
> 
> I have not encountered the above problem.
> 
>> The ECW file is created, but it contains garbage.
> 
> I did find this, and it was because you named the ECW file
> with the same base name as the .HDR file.  Because of the order
> the format drivers were being tried, the file got opened as a
> raw BIL file using the .HDR instead of as an ECW file and the
> result was garbage.  In "trunk" the EHdr driver has been
> demoted to help avoid this sort of problem.  But I would discourage
> you from using the same basename as all the support files or you
> may encounter surprising interactions.
> 
> Best regards,

Hello Frank,

Thanks for your quick answer.
Your advice was very good. I have used a different base name for the 
output file. The errors have disappeared, and the output file is correct.

Best regards,
Jean-Claude



More information about the gdal-dev mailing list