[Gdal-dev] Re: [GRASS5] export RGB channels in one ERDAS/IMG file
otto.dassau at gmx.de
Wed Sep 29 11:21:23 EDT 2004
On Tue, 31 Aug 2004 13:05:51 -0400
Frank Warmerdam <warmerdam at pobox.com> wrote:
> Otto Dassau wrote:
> > Dear list,
> > I would like to export several rasterfiles (channels R,G,B,..) in one ERDAS/IMG
> > file with GDAL. Is this possible?
> > r.out.gdal is working, but I can't find an option how to do this in the manual
> > pages. Does anybody has an idea?
> I did a quick check of r.out.gdal and it does not seem to support outputting
> more than one raster layer at a time to an output file even though I can see
> that would be highly desirable. Likely it should offer an option to export
> a "group" as that is the equivelent to a stack of image bands in GDALs data
Now I export single layers (R,G,B) into ERDAS format and use gdal_merge.py to put them in one layer stack, but there is a problem:
gdal_merge.py works with small layers (e.g. 2000x2000 pixels) but crashes with large data sets (31476x31818).
gdal_merge.py -v -of HFA 1.img -separate 1b.img 1g.img 1r.img
File Size: 31476x31818x3
Pixel Size: 0.320000 x -0.320000
Copy 0,0,31476,31818 to 0,0,31476,31818.
ERROR 1: 1.img:0: Invalid strip byte count, strip 0
ERROR 1: TIFFReadEncodedStrip() failed.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
Traceback (most recent call last):
File "/usr/local/bin/gdal_merge.py", line 439, in ?
fi.copy_into( t_fh, 1, t_band, nodata )
File "/usr/local/bin/gdal_merge.py", line 268, in copy_into
File "/usr/local/bin/gdal_merge.py", line 101, in raster_copy
t_xsize, t_ysize, t_band.DataType )
File "/usr/lib/python2.3/site-packages/gdal.py", line 690, in ReadRaster
TypeError: GetBlockRef failed at X block offset 0, Y block offset 0
Why is there a problem with TIFF, although I export to ERDAS?
thanks a lot
> Given that it does not, it seems you might have to do this all rather
> indirectly. One approach is to output individual rasters and then composite
> them with an external application like OpenEV or within Imagine itself.
More information about the Gdal-dev