[Gdal-dev] Dealing with a GeoTiff with incorrect band ColorInterp values

Ben Greene bgreene at rapidmap.com.au
Thu May 10 01:59:11 EDT 2007


I have a geotiff I'm testing my C# program with, which has three bands:
Band 1 is ColorInterp.GCI_GrayIndex, and the other two are
ColorInterp.GCI_Undefined.  The three bands are actually meant to be R,
G, B in this particular image.

 

I'm using the command-line gdalwarp to save the file back to disk as
with large datasets I've had problems with OutOfMemoryExceptions when
doing too much processing in memory.

 

I have to take this image and warp it to WGS84 and then extract tiles
out of it to insert into a database, but gdalwarp gives the following
error:

 

ERROR 5: GDALDataset::GetRasterBand(2) - Illegal band #

 

ERROR 5: GDALDataset::GetRasterBand(3) - Illegal band #

 

ERROR 5: panDstBands[1] = 2 ... out of range for dataset.

 

I don't want my program to modify the original image, just in case RGB
isn't the correct interpretation, and don't want to have to copy the
image, fix the ColorInterp values, and then warp it to create a third
copy.

 

Is there an option to force RGB interpretation of bands in a Tiff?  Or
do I have to correct the ColorInterp values?

 

Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070510/849ca9eb/attachment.html


More information about the Gdal-dev mailing list