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

Frank Warmerdam warmerdam at pobox.com
Tue Mar 25 09:48:29 EDT 2008


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,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list