I'm working with QGIS 1.8 (gdal 1.9.2) and GRASS 6.4.3...but on Windows 7.

I "just" want to merge my raster.

I've got a folder with 50 GTiff raster from Lidar data.

The aim is to merge raster before or after an import into GRASS in order to do some contours...

Before GRASS, I tried gdal_merge with QGIS's gui, without any option. I had an error message : "permission denied".

So I tried it in GRASS with r.patch but : First the gui don't allows you to select multiple raster at one time...

Then I don't know how to batch with GRASS functions in Windows...I tried the GRASS command line but can't locate in the current mapset (didn't understand how). When I had the windows installer for QGIS, this commandline putted you in the current mapset but it's not the case with the basic installation of QGIS.

I'm quite locked...Any help ?

1 Answer 1

  • Open MSYS (It should have been downloaded along if you used OSGeo4W utility to install qgis)
  • cd (Change Directory) to your folder with your data.
    • cd c:/(path to)/(my data)/ (Hint: pressing tab, autocompletes)
  • one-line it: gdal_merge.py -o out.tif $(ls *.tif)
    • out.tif -> is your output file, name it to whatever you want.
    • $(ls *.tif) -> lists all the files ending with tif, and parses it at a parameter to gdal_merge. Change it as needed.

you can explore more options of gdal_merge.py at the relevant page.

  • Thank you for the tip but MSYS doesn't work. When I try to open it, I have on error message : "Window doesn't find C:\Program. Check the name and try again". I didn't installed QGIS with the advance OSGeo4w installer because I definitely want use GRASS inside QGIS.
    – Samy-DT
    Commented Jul 28, 2013 at 15:19
  • 1
    MSYS has problems with blanks in pathnames. The OSGEO4W shell should overcome this problem. You can run GDAL commands inside it in the same way.
    – AndreJ
    Commented Jan 28, 2014 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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