I am really new in GRASS and my question is really basic but I don't realize where I am wrong.

I have a set of single layers in my PERMANENT from some Landsat images (1 Landsat = 7 one layer rasters). I would like to export group (named "stack" in R) of these layers = forming 1 Landsat image to .img. I suppose the following steps to do it in GRASS:

  1. Import single layer to GRASS (there is no way to import multiple layer in one time?): r.in.gdal
  2. Create "group" = multiband raster from singleband rasters: i.group.
  3. Export multiband raster as new format: r.out.gdal

My problem is why when I use i.group I see that actually I have a group of my bands:

enter image description here

but if I want to export group of my layers a see only single bands, not the group!! enter image description here

Please, any idea how to create and export multiband raster to .img in GRASS? (and try to avoid python?). As my bands are in GRASS format, I can't easily do the job in software more convenient for me.

  • I have always found GRASS GIS to be a confusing bit of software. Which tool is it that is only available there? Commented Feb 18, 2015 at 14:37
  • for all here mentionned tools I can find an alternative. Only I can´t find/store the result of "i.group" and therefore I can´t export it as whole raster stack... I can export my layers by layer but it so unefficient and boring...
    – maycca
    Commented Feb 18, 2015 at 17:27
  • I was thinking for of the tools that you didn't mention. There must be a reason why you are using the GRASS GIS GUI and not QGIS, GRASS GIS commandline, R or similar. Commented Feb 18, 2015 at 18:04

1 Answer 1


I will provide here commands but you can just find the given options in the dialogs. According to your question I suppose you already have a GRASS imagery group. So, I will just focus on exporting the group into a multi-band image format.

First, see what are the output formats are supported:

r.out.gdal -l

This will give you long list which contains also HFA/.img format which you want:

HFA (rw+): Erdas Imagine Images (.img)

Next, see what groups you have:

g.list type=group

In my case, that's only one group:


Just to be sure check which rasters are in the group:

i.group group=lsat7_2000 -l

In my case, it is:

group <lsat7_2000> references the following raster maps
<lsat7_2000_10@landsat>    <lsat7_2000_20@landsat>    
<lsat7_2000_30@landsat>    <lsat7_2000_40@landsat>    
<lsat7_2000_50@landsat>    <lsat7_2000_61@landsat>    
<lsat7_2000_70@landsat>    <lsat7_2000_80@landsat>    

So, we know that the name of the group is lsat7_2000 and name of the format in GDAL is HFA.

Now you can fill lsat7_2000 into Name of raster map (or group) to export field in the r.out.gdal dialog, HFA into Raster data format to write field and name (and path) of output file into Name for output raster file field.

In command line, it looks like this:

r.out.gdal input=lsat7_2000 output=some/path/landsat_2000.img format=HFA

The source of your confusion might be that the input option (field) of r.out.gdal says raster map (or group) but the GUI offers only raster maps. However, the GUI will allow you to write there anything manually (i.e. not select from the list), so you can put there the name of the group.

  • Hi @wenzeslaus, great, it works! However, the process is too slow (30 min to export one image). Please, is there possibility to reduce the time? I think that is caused because of the 16 bit pixel depth.
    – maycca
    Commented Feb 19, 2015 at 9:19
  • I don't know about a way of reducing the export time. There is definitively a lot of IO (disk operations), so this is why the process is slow. Using SSD disk might be helpful. What is the size of your area (number of cells)?
    – wenzeslaus
    Commented Feb 20, 2015 at 4:16
  • It is whole Landsat scene. However, thank you very much, it work :)
    – maycca
    Commented Feb 20, 2015 at 8:33
  • I'm glad it worked for you. The only thing to make it faster (besides better hardware) is to run more r.out.gdal commands in parallel in case you have more than one GRASS imagery group. However, since the operation is IO bound, the performance of parallel solution depends on the combination of hard disks you are using (SSD disk or more different hard disks might improve it, but it might be just the same). It might also depend on the file system used but I really cannot elaborate on that.
    – wenzeslaus
    Commented Feb 20, 2015 at 22:57
  • If you would be doing it over and over, then it might be better to look at r.external which can link the data into GRASS Database.
    – wenzeslaus
    Commented Feb 20, 2015 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.