[Gdal-dev] Re: [GRASS5] export RGB channels in one ERDAS/IMG file
Otto Dassau
otto.dassau at gmx.de
Thu Sep 30 06:17:31 EDT 2004
On Wed, 29 Sep 2004 13:31:36 -0400
Frank Warmerdam <warmerdam at pobox.com> wrote:
> Otto Dassau wrote:
>
> > ###ERROR:
> > gdal_merge.py -v -of HFA 1.img -separate 1b.img 1g.img 1r.img
> >
> > Filename: 1.img
> > File Size: 31476x31818x3
> > Pixel Size: 0.320000 x -0.320000
> > UL:(3367943.360000,5941153.600000) LR:(3378015.680000,5930971.840000)
> > 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
> > nodata_arg )
> > 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
> > buf_xsize, buf_ysize,buf_type)
> > TypeError: GetBlockRef failed at X block offset 0, Y block offset 0
> >
> > Why is there a problem with TIFF, although I export to ERDAS?
>
> Otto,
>
> I don't know why. How sure are you that 1g.img, 1r.img and 1b.img are
> really imagine files? I would verify this with gdalinfo.
>
> BTW, I think you need to use the -o flag otherwise output goes to
> out.tif. So try:
>
> gdal_merge.py -v -of HFA -o 1.img -separate 1b.img 1g.img 1r.img
>
> If problems persist you will need to give us more information. Does
> gdal_merge.py work with only one input file (try each)? etc.
>
Hi,
ok sorry, more information, I don't know what you need, so I start answering your 3 questions first:
a) B,G,R are IMAGINE files:
gdalinfo 1b.img | more
Driver: HFA/Erdas Imagine Images (.img)
Size is 31476, 31818
Coordinate System is:
PROJCS["Transverse Mercator",
GEOGCS["Deutsches_Hauptdreiecksnetz",
DATUM["Deutsches_Hauptdreiecksnetz",
SPHEROID["bessel",6377397.155,299.1528128000033],
TOWGS84[590.5,69.5,411.6,-0.796,-0.052,-3.601,8.3]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",3500000],
PARAMETER["false_northing",0],
UNIT["meters",1]]
Origin = (3367943.360000,5941153.600000)
Pixel Size = (0.32000000,-0.32000000)
Corner Coordinates:
Upper Left ( 3367943.360, 5941153.600) ( 7d 0'19.92"E, 53d35'12.17"N)
Lower Left ( 3367943.360, 5930971.840) ( 7d 0'35.38"E, 53d29'42.99"N)
Upper Right ( 3378015.680, 5941153.600) ( 7d 9'27.24"E, 53d35'20.95"N)
Lower Right ( 3378015.680, 5930971.840) ( 7d 9'41.53"E, 53d29'51.74"N)
Center ( 3372979.520, 5936062.720) ( 7d 5'1.02"E, 53d32'32.05"N)
Band 1 Block=64x64 Type=Int16, ColorInterp=Palette
Color Table (RGB with 65536 entries)
...
gdalinfo 1g.img | more
Driver: HFA/Erdas Imagine Images (.img)
Size is 31476, 31818
Coordinate System is:
PROJCS["Transverse Mercator",
GEOGCS["Deutsches_Hauptdreiecksnetz",
DATUM["Deutsches_Hauptdreiecksnetz",
SPHEROID["bessel",6377397.155,299.1528128000033],
TOWGS84[590.5,69.5,411.6,-0.796,-0.052,-3.601,8.3]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",3500000],
PARAMETER["false_northing",0],
UNIT["meters",1]]
Origin = (3367943.360000,5941153.600000)
Pixel Size = (0.32000000,-0.32000000)
Corner Coordinates:
Upper Left ( 3367943.360, 5941153.600) ( 7d 0'19.92"E, 53d35'12.17"N)
Lower Left ( 3367943.360, 5930971.840) ( 7d 0'35.38"E, 53d29'42.99"N)
Upper Right ( 3378015.680, 5941153.600) ( 7d 9'27.24"E, 53d35'20.95"N)
Lower Right ( 3378015.680, 5930971.840) ( 7d 9'41.53"E, 53d29'51.74"N)
Center ( 3372979.520, 5936062.720) ( 7d 5'1.02"E, 53d32'32.05"N)
Band 1 Block=64x64 Type=Int16, ColorInterp=Palette
Color Table (RGB with 65536 entries)
...
gdalinfo 1r.img | more
Driver: HFA/Erdas Imagine Images (.img)
Size is 31476, 31818
Coordinate System is:
PROJCS["Transverse Mercator",
GEOGCS["Deutsches_Hauptdreiecksnetz",
DATUM["Deutsches_Hauptdreiecksnetz",
SPHEROID["bessel",6377397.155,299.1528128000033],
TOWGS84[590.5,69.5,411.6,-0.796,-0.052,-3.601,8.3]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",3500000],
PARAMETER["false_northing",0],
UNIT["meters",1]]
Origin = (3367943.360000,5941153.600000)
Pixel Size = (0.32000000,-0.32000000)
Corner Coordinates:
Upper Left ( 3367943.360, 5941153.600) ( 7d 0'19.92"E, 53d35'12.17"N)
Lower Left ( 3367943.360, 5930971.840) ( 7d 0'35.38"E, 53d29'42.99"N)
Upper Right ( 3378015.680, 5941153.600) ( 7d 9'27.24"E, 53d35'20.95"N)
Lower Right ( 3378015.680, 5930971.840) ( 7d 9'41.53"E, 53d29'51.74"N)
Center ( 3372979.520, 5936062.720) ( 7d 5'1.02"E, 53d32'32.05"N)
Band 1 Block=64x64 Type=Int16, ColorInterp=Palette
Color Table (RGB with 65248 entries)
...
b) The "you need to use the -o flag" error was my fault, but still it doesn't work.
Filename: 1b.img
File Size: 31476x31818x1
Pixel Size: 0.320000 x -0.320000
UL:(3367943.360000,5941153.600000) LR:(3378015.680000,5930971.840000)
Copy 0,0,31476,31818 to 0,0,31476,31818.
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
...
c) does gdal_merge.py work with only one input file
gdal_merge.py -v -of HFA -o 1.img -separate 1b.img
Filename: 1b.img
File Size: 31476x31818x1
Pixel Size: 0.320000 x -0.320000
UL:(3367943.360000,5941153.600000) LR:(3378015.680000,5930971.840000)
Copy 0,0,31476,31818 to 0,0,31476,31818.
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
gdal_merge.py -v -of HFA -o 1.img -separate 1g.img
Filename: 1g.img
File Size: 31476x31818x1
Pixel Size: 0.320000 x -0.320000
UL:(3367943.360000,5941153.600000) LR:(3378015.680000,5930971.840000)
Copy 0,0,31476,31818 to 0,0,31476,31818.
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
gdal_merge.py -v -of HFA -o 1.img -separate 1r.img
Filename: 1r.img
File Size: 31476x31818x1
Pixel Size: 0.320000 x -0.320000
UL:(3367943.360000,5941153.600000) LR:(3378015.680000,5930971.840000)
Copy 0,0,31476,31818 to 0,0,31476,31818.
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
ERROR 1: TIFFWriteEncodedStrip:1.img: File not open for writing
Otto
More information about the Gdal-dev
mailing list