[GRASS-user] exporting Grass rasters to multiband Geotiff?

Hi all,

I would like to know how i can export, say, 12 grass rasters (call them map.1 to map.12) into a single GeoTiff file.
Looks like r.out.gdal allows only one band Geotiff?
What about gdal_translate? I used gdal_translate to import from Netcdf to multi-band GeoTiff months ago, but am not sure how it works for exporting from Grass to multi-band GeoTiff.

maybe something like :
gdal_translate -ot Int16 -of GTiff -b 1 -b 2 … -b 12 map.1 map.2 …map.12 out.tiff
would the above work?

if this cannot be done, i need to export into some other multi-band format - would exporting to Erdas Imagine (.img) format work for multi-band?

thanks,
vishal

I actually did look at previous emails but could not get a definite answer, and also did’nt follow the VRT discussion in earier emails.

Meanwhile actually, I’m having trouble with using r.out.gdal on even a single image .
My original grass raster has integer values from -262 to 276, and the r.info output says that its CELL format . So i assumed that the type is Int16, and used the following command:

r.out.gdal input=avgtemp1960.1 format=GTiff type=Int16 output=jan1960.tiff createopt=“TFW=YES”

I then imported the output Geotiff into both IDRISI as well as GRASS(using r.in.gdal)

In both cases, the values are completely different and go from 0 to 32767.

Int32 and Float32 options dont work either. Any ideas?

In my opinion, I find that in general, the documentation for this in Grass as well as Gdal is inadequate. There should be one example for each type of format…

And what is the difference between ‘Tiles’ and ‘Bands’?

Finally, where can i figure out what Int16/32, Float32, Cint16, Cint32 - what these things mean?

thanks,
vishal

On 11/2/06, Hamish <hamish_nospam@yahoo.com> wrote:

Vishal Mehta wrote:

Hi all,

I would like to know how i can export, say, 12 grass rasters (call
them map.1 to map.12) into a single GeoTiff file.
Looks like r.out.gdal allows only one band Geotiff?
What about gdal_translate? I used gdal_translate to import from Netcdf
to multi-band GeoTiff months ago, but am not sure how it works for
exporting from Grass to multi-band GeoTiff.

maybe something like :
gdal_translate -ot Int16 -of GTiff -b 1 -b 2 … -b 12 map.1
map.2…map.12 out.tiff
would the above work?

if this cannot be done, i need to export into some other multi-band
format - would exporting to Erdas Imagine (.img) format work for
multi-band?

this was disccussed earlier this year on the mailing lists, you might
search for a solution there.

From memory, using the gdal tools was the current “best” solution, I
think you are very much on the right path.

Hamish

Vishal Mehta wrote:

I actually did look at previous emails but could not get a definite answer, and also did'nt follow the VRT discussion in earier emails.

Meanwhile actually, I'm having trouble with using r.out.gdal on even a single image .
My original grass raster has integer values from -262 to 276, and the r.info <http://r.info> output says that its CELL format . So i assumed that the type is Int16, and used the following command:

r.out.gdal input=avgtemp1960.1 format=GTiff type=Int16 output=jan1960.tiff createopt="TFW=YES"

I then imported the output Geotiff into both IDRISI as well as GRASS(using r.in.gdal)

In both cases, the values are completely different and go from 0 to 32767.

Vishal,

This sounds like there may be a bug in r.out.gdal. Int16 should be
an appropriate selection.

Int32 and Float32 options dont work either. Any ideas?

In my opinion, I find that in general, the documentation for this in Grass as well as Gdal is inadequate. There should be one example for each type of format..

You are suggesting that the GDAL documentation ought to have one example
of using the format for each format driver page? Should the example
use GDAL commandline tools? GRASS? ArcGIS? As a library it is very
hard to provide a meaningful example to end users when the library is
used in many different applications.

I hope you will recognise that in a decoupled system such as GRASS and
GDAL it is difficult to document everything in a most convenient way
for the user.

And what is the difference between 'Tiles' and 'Bands'?

I think you should scan the data model document on the gdal page,
and then if it is still unclear ask again.

Finally, where can i figure out what Int16/32, Float32, Cint16, Cint32 - what these things mean?

You can read the GDAL web pages - look for "data model".

But mostly they mean what you would expect. Int16 is a signed 16bit
integer. Float32 is a 32bit IEEE floating point. CInt16 is a bit trickier.
It is a signed 16bit integer complex value (ie. two Int16's one representing
the real component, and one the imaginary component).

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 | President OSGeo, http://osgeo.org