[GRASS-user] problem whit raster images

Markus Neteler neteler at itc.it
Thu Jul 6 03:33:18 EDT 2006


On Thu, Jul 06, 2006 at 06:58:01PM +1200, Hamish wrote:
> Wolfgang wrote:
> 
> > usually during input the colors are getting separated into the "red", 
> > "green" and "blue" chanal (you can display these chanals as gray scale
> > 
> > images). For displaying you could use:
> >   d.rgb red=map.red green=map.green blue=map.blue
> > An alternative is to merge them first:
> >   r.composite red=map.red green=map.green blue=map.blue output=map.rgb
> >   d.rast map.rgb
> > (replace 'map' with your map name)
> 
> 
> Hi,
> 
> any ideas on how to output 3 R,G,B rasters into a single 3-band GeoTIFF
> without resolution loss? (ie no r.composite 256->32 col/band reduction)

Hi Hamish,
since r.out.gdal is still a shell wrappper to gdal_translate,
everything possible with gdal_translate should be(come) possible
with r.out.gdal.
 
> r.out.gdal only takes a single input= map.

You could try to change that to multi.
BUT: I guess that gdal_translate only accepts one map.

> run r.out.gdal for each band then merge somehow with gdal_translate??

What about this:
make r.out.gdal input multi, loop over all input channels 
(say, put the code in r.out.gdal into the loop), if more
than one input map, call gdalwarp to merge them:

gdalwarp [--help-general] [--formats]
    [-of format] [-co "NAME=VALUE"]* srcfile* dstfile
                                          ^^^^-!

It's not well documented AFAIK that gdalwarp can be used
for such tricks (I only darkly remember some discussion
on this in the gdal ML). There should be no need to
use gdal_merge.py which would introduce an extra
dependency.

Markus




More information about the grass-user mailing list