5

I have heard that I can use a vrt file to merge multiple geotiffs into one?

what is the syntax?

gdal_tranlsate -of VRT file1.tif file2.tif file2.tif

Something like this?

tinlyx
  • 11,057
  • 18
  • 71
  • 119
Robert Buckley
  • 10,175
  • 14
  • 76
  • 156

3 Answers3

7

No, you need to use gdalbuildvrt The instructions on the page are pretty clear, but to save you a mouse click, one of the examples is:

gdalbuildvrt doq_index.vrt doq/*.tif
MerseyViking
  • 14,543
  • 1
  • 41
  • 75
  • Ah...I see i have gdal 1.6.0. I guess this is only from 1.7.0 – Robert Buckley Mar 14 '12 at 17:22
  • It was compiled by default from 1.6.1 onwards. It's worth biting the bullet and upgrading to 1.9 for the extras as well as a good few bug fixes. An alternative would be to look at the page describing VRTs and construct one by hand. It is then treated as a regular format by the rest of the tools. – MerseyViking Mar 15 '12 at 11:11
4

More specifically to merge multiple tifs in one directory.

gdalbuildvrt out.vrt *.tif

gdal_translate -of GTiff -a_srs epsg:900913 in.vrt  out.tif
tinlyx
  • 11,057
  • 18
  • 71
  • 119
ZackOfAllTrades
  • 173
  • 1
  • 7
1

gdalbuildvrt will build a virtual vrt file with all your individual .tif files, but if you want to convert the .vrt back into a big single .tif file, you need to use gdal_translate.

Web-GIS entrepreneur
  • 1,545
  • 1
  • 13
  • 28