[GRASS-user] Handling 700 Dtm files in Grass
hamish_b at yahoo.com
Mon Feb 13 23:38:48 EST 2012
> I need to merge 700 arcinfo ascii files so they can be imported into
> Grass then saved as a single geotif, How can this best be done?.
> It is possible to import them one at a time but this is not practical.
a simple unix shell loop will do it, (use "with MSys" on MS-Windows)
for file in *.asc ; do
r.in.arc in="$file" out=`basename $file .asc`
or there is a bulk import GDAL tool in the wxGUI to try.
once imported into grass you can use the g.mlist module to list
them all and set the region, then use r.patch.
g.region rast=`g.mlist rast pattern=ABC*`
r.patch in=`g.mlist rast pattern=ABC*` out=mosaic
or if you are willing to get adventurous the most efficient way is to
create a GDAL "vrt" virtual map file with all the arc file names in
it, then connect to it in GRASS using r.external. the original maps
are all read in place as if they were patched together already. then
r.mapcalc "all_maps = virtual_external_link"
to make it into a GRASS map.
see the gdal.org site for help on making the .vrt file.
More information about the grass-user