[GIS] Merging all tiles from one directory using GDAL

gdalmosaicosgeo4wshell

I would like to use GDAL (under Windows; OSGeo4W Shell) to merge all GeoTIFFs from one directory into a new GeoTIFF. I have tried to address them by writing c:\data\....\*.tif which however does not seem to work, using the Windows environment.

I am looking for the most practicable way to perform this operation; if possible completely within the OSGeo4W Shell. Addressing every single mosaic part name 'by hand' in the Shell is not an option.

Best Answer

You could create a virtual mosaic from all Tiff files:

gdalbuildvrt mosaic.vrt c:\data\....\*.tif

and convert it afterwards:

gdal_translate -of GTiff -co "COMPRESS=JPEG" -co "PHOTOMETRIC=YCBCR" -co "TILED=YES" mosaic.vrt mosaic.tif

Keep an eye on all the GDAL creation parameters to compress your mosaic and use gdaladdo to add overviews.

More info here: GeoTiff Compression for Dummies - Paul Ramsey