[GRASS-user] Combining Rasters Help

Hamish hamish_nospam at yahoo.com
Thu Jul 20 22:28:31 EDT 2006


Carlos:
> If you want to patch them toghether, i.e., create a single raster from
> several pieces, you can use r.patch.
> 
> this is from the man page of r.patch:
> 
> MAPS=`g.mlist type=rast sep=, pat="map_*"`
> g.region rast=$MAPS
> r.patch in=$MAPS out=mosaic
> 
> it works well, I used it to patch SRTM30 tiles.

Dylan:
> I do not recall the exact file, but a constant in the source code
> defining the max_open_files or something like that needs to be
> changed.


grass6/raster/r.patch/nfiles.h :

/* The number of cell files that can be patched together.
 *
 * All cell files will be opened at one time, so this number can not
 * be arbitrarily large.
 *
 * Must be smaller than MAXFILES as defined in lib/gis/G.h which 
 * in turn must be smaller than the operating system's limit.
 *  (Given by `cat /proc/sys/fs/file-max` in Linux 2.4)
 */

#define MAXFILES 200


(this is the same in GRASS 5.4.0)


you can increase those numbers (a bit) or run the task in smaller 
sections, then combine the pieces with another r.patch pass as a final
step.


tip:
 INMAPS=map1,map2,map3,map4,...  # or `g.mlist sep=,`
 g.region rast=$INMAPS    # extend region to extent of all maps



Hamish




More information about the grass-user mailing list