Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to import some GDAL supported raster files into a binary raster map layer using the module from QGis Grass tool.

As I have multiple files to import, I would like to batch import them.

Is is possible or should do I have to repeat the same operation for every single file?

I work with QGis 1.8.0 Lisboa.

share|improve this question
We assume Windows OS? – nickves Nov 16 '12 at 8:31
Yes, sorry, Windows 7. – Bap Nov 16 '12 at 17:29
up vote 3 down vote accepted

Just for the record, the GRASS graphical user interface offers a convenient bulk import tool:

enter image description here

share|improve this answer

You can easily do this using QGIS python console. To get Python Console

QGIS 1.8.0 Lisboa -> Plugins -> Python Console

Find the attached screenshot which loads all files(vector - shape) from a specific directory QGIS bactch load layers

Below is the code for loading vectors.

shps = glob.glob(os.path.join(shp_path,"*.shp"))
for shp in shps:
    (shpdir, shpfile) = os.path.split(shp)
    qgis.utils.iface.addVectorLayer(shp, shpfile, 'ogr' )

For your purpose you need to modify a bit


#you can say other extension or *.*
rasts = glob.glob(os.path.join(raster_path,"*.tif")) 
for rast in rasts:
    (rastdir, rastfile) = os.path.split(rast)
    qgis.utils.iface.addRasterLayer(rastfile, "raster")

Hope that helps

share|improve this answer
I had a few problems with the Python code (probably because I had never used Python before...), so I used the GRASS interface. It works really well. Thank you! – Bap Nov 19 '12 at 22:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.