[GRASS5] scripting r.in.gdal

Moritz Lennert mlennert at club.worldonline.be
Tue Jun 29 14:17:16 EDT 2004


> I would like to automate the import processes (if possible). I have
> several hundred tifs that I need to read into grass with r.in.gdal into
> an xy location (before I rectify them). The command:
>
>   r.in.gdal in=T56N.R9W.tif out=t56n.r9w.tif
>
> works just fine.
>
> Can anyone get me started setting up a script that could run through a
> directory full of tifs that looked something like this:
>
> T56N.R10W.tif           T61N.R19W.tif           T64N.R4W.tif
> T56N.R11W.tif           T61N.R20W.tif           T64N.R5W.1.tif
> T56N.R12W.tif           T61N.R2E.tif            T64N.R5W.tif
> T56N.R13W.1.tif    add infinitum...
>
> reading each tif into grass with r.in.gdal (the renameing bit is
> gravy... I can do that in a second step if necessary with a  regular
> expression).
>

within the directory full of tiffs:

for file in *.tif
do
newname = `echo $file | awk '{print tolower($1)}`
r.in.gdal in=$file out=$newname
done

Moritz







More information about the grass-dev mailing list