0

I have 100 folders and in each folder, I have 50 dem tiffs. I want to merge the tiff from each folder and save it inside the master folder. I tried using Raster as an input in graphical modeler but it doesn't pick all files.

2
  • Test from Processing Tools, GDAL Merge algorithm, this allows you to select folders
    – pigreco
    Commented Feb 16, 2022 at 11:51
  • Nope! It does not allow. Tried.
    – MapQuest
    Commented Feb 16, 2022 at 12:01

1 Answer 1

2

I assume you want to mosaic the different raster "tiles" into a main thing. You can do this easily with gdal on the shell:

for fich in `ls my_folder/*.tif`
do
    cat ${fich} >> file_of_files.txt
done

gdalbuildvrt -input_file_list file_of_files.txt mosaic.vrt
gdal_translate -of GTiff mosaic.vrt, mosaic.tif

You can also do something similar using the GDAL Python bindings. In fact the last line just converts the virtual mosaic into a GeoTIFF, but QGIS will read the VRT file reasonably well (it has issues if you change paths, so probably safer to convert to GeoTIFF).

1
  • I want to merge raster from each folder and want to save the merged master inside the same folder, So if I have 100 folders consisting of tiff images, want to save 100 merged tiff inside each folder. Can this be done in Graphical modeler QGIS?
    – MapQuest
    Commented Feb 17, 2022 at 5:46

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.