[GRASS5] export RGB channels in one ERDAS/IMG file

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?

thanks
  Otto

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?

Otto,

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
model.

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.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent

On Tue, Aug 31, 2004 at 01:05:51PM -0400, Frank Warmerdam 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?

Otto,

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
model.

Frank,

this could be added easily. But I don't know how to tell 'gdal_translate'
about it.
The docs only mention single-file input:
http://www.remotesensing.org/gdal/gdal_utilities.html#gdal_translate

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.

As I also need that functionality, I'll add it once I have understood
the gdal_translate procedure...

Markus

Markus Neteler wrote:

Frank,

this could be added easily. But I don't know how to tell 'gdal_translate'
about it.
The docs only mention single-file input:
http://www.remotesensing.org/gdal/gdal_utilities.html#gdal_translate

Markus,

gdal_translate doesn't support multiple input files. Holy cow! r.out.gdal
is just a script! OK, that isn't news to you but it is to me. I will add
writing a C r.out.gdal to my TODO list.

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.

As I also need that functionality, I'll add it once I have understood
the gdal_translate procedure...

In the meantime, I don't think it will be easy to do from within GRASS.

BTW, before I forgot that gdal_merge.py can stack input files into seperate
bands if given the -seperate switch. So for anyone with a GDAL build that
includes python support you could export the various bands to standalone
files and then merge them into an RGB composite with:

   gdal_merge.py -o out.img -of HFA -seperate band1.img band2.img band3.img

Best regards,

--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent

Isn't it possible to simply use GRASS groups, which are represented
as multiband in GDAL?

Radim

On Thursday 02 September 2004 15:39, Frank Warmerdam wrote:

Markus Neteler wrote:
> Frank,
>
> this could be added easily. But I don't know how to tell 'gdal_translate'
> about it.
> The docs only mention single-file input:
> http://www.remotesensing.org/gdal/gdal_utilities.html#gdal_translate

Markus,

gdal_translate doesn't support multiple input files. Holy cow! r.out.gdal
is just a script! OK, that isn't news to you but it is to me. I will add
writing a C r.out.gdal to my TODO list.

>>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.
>
> As I also need that functionality, I'll add it once I have understood
> the gdal_translate procedure...

In the meantime, I don't think it will be easy to do from within GRASS.

BTW, before I forgot that gdal_merge.py can stack input files into seperate
bands if given the -seperate switch. So for anyone with a GDAL build that
includes python support you could export the various bands to standalone
files and then merge them into an RGB composite with:

   gdal_merge.py -o out.img -of HFA -seperate band1.img band2.img band3.img

Best regards,

On Thu, Sep 02, 2004 at 09:39:33AM -0400, Frank Warmerdam wrote:

Markus Neteler wrote:
>
>Frank,
>
>this could be added easily. But I don't know how to tell 'gdal_translate'
>about it.
>The docs only mention single-file input:
>http://www.remotesensing.org/gdal/gdal_utilities.html#gdal_translate

Markus,

gdal_translate doesn't support multiple input files. Holy cow! r.out.gdal
is just a script! OK, that isn't news to you but it is to me. I will add
writing a C r.out.gdal to my TODO list.

Hooray :slight_smile: Was hoping for that a long time (I tried myself a bit but failed).

>>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.
>
>
>As I also need that functionality, I'll add it once I have understood
>the gdal_translate procedure...

In the meantime, I don't think it will be easy to do from within GRASS.

BTW, before I forgot that gdal_merge.py can stack input files into seperate
bands if given the -seperate switch. So for anyone with a GDAL build that
includes python support you could export the various bands to standalone
files and then merge them into an RGB composite with:

  gdal_merge.py -o out.img -of HFA -seperate band1.img band2.img band3.img

Thanks for the hint, I was't aware of that flag yet.
(so I could mess up my script a bit more)

Markus

Radim Blazek wrote:

Isn't it possible to simply use GRASS groups, which are represented
as multiband in GDAL?

grass.itc.it/mailman/listinfo/grass5

Radim,

I am a moron. Yes, I think you are right. The script might need to be
changed a bit to allow selecting groups, but it should be a minor change.

Best regards,

--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent