[GRASS-dev] More efficient to use r.mapcalc or r.patch in a l oop for creating mosaics?

Hamish hamish_nospam at yahoo.com
Fri May 12 01:03:24 EDT 2006


> Thanks for the reply. What if the maps aren't fed to r.patch in order
> of rows/columns, but in some random order with respect to the entire
> region (like alphabetical order, for instance).

If maps overlap at all, r.patch will use the values from the first map
listed as the value. So order matters.


> Here's a snippet from my script, for example:
> 
> 
> declare -a PATCHLIST
> 
> i=0
> for MAP in `g.mlist type=rast pattern=$INPUT` ; do
> 
> 	PATCHLIST[${i}]=${MAP}
> 	i=$((${i} + 1))
> done


why not just:

MAPS=`g.mlist pat="map_*" sep=,`
r.patch in=$MAPS out=patched_maps

or together

r.patch in="`g.mlist pat="map_*" sep=,`" out=patched_maps


note r.out.mpeg has wildcard code built-in for input maps.
Probably best not to go around adding this module by module. 
Into G_parser() [multiple="YES"], if at all.


Hamish




More information about the grass-dev mailing list