[GRASS-user] Handling 700 Dtm files in Grass
Hamish
hamish_b at yahoo.com
Mon Feb 13 23:38:48 EST 2012
Paul wrote:
> 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`
done
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
(then wait)
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.
Hamish
More information about the grass-user
mailing list