[GRASS-user] Batch import

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Wed Jun 23 20:03:38 EDT 2010


(please keep this on-list)
 
Shaun Langley wrote:
> >> I am trying to import several hundred images into Grass. This is
> >> obviously painful to do by hand. I've tried searching for batch scripts
> >> but haven't found one. Can anyone help?

Nikos Alexandris:
> > Linux or Window$?

Shaun Langley:
> Mac or Linux

You can use bash (the well known shell under most Linux distros) one-liners or 
script(s). Something like:

# enter in the directory which holds the images
# assuming all are Geotiff and lie on the same spatial reference system
cd Directory

# use r.in.gdal within a "for" loop
for TIF in *.tif; do r.in.gdal in="${TIF}" out="${TIF}" ; done

# or to avoid the ".tif" in the name of the imported grass
for TIF in *.tif ; do r.in.gdal in="${TIF}" out="`echo ${TIF} | cut -d"." -
f1`" ; done

Under the GUI I have no idea (currently).

Good luck, Nikos


More information about the grass-user mailing list