When building a single georeferenced image from a collection of tiles, gdalbuildvrt followed by gdal_translate is much faster than gdal_merge.py.

In my own measurements of

gdal_merge.py \
        --config GDAL_CACHEMAX 3000 \
        --optfile filelist.txt \
        -o $output_file


gdalbuildvrt \
        -input_file_list filelist.txt \
gdal_translate \
        $tmpdirname/out.vrt \
        -of GTiff \

on a collection of 46 GeoTIFFs of 600×600px each, I got over 30min vs. 1min 58s.

It seems strange that the detour via a virtual dataset is so much more performant. Does it have any downsides?

When should I use gdal_merge.py instead, anyway? (And if there aren't any cases for that with gdal_merge.py's current implementation, why isn't gdal_merge.py instead just implemented as an alias to these two actions?)

  • According to this mailing list post, gdal_translate doesn't properly handle alpha / mask / nodata, while gdal_merge.py handles them as binary mask and gdalmerge does proper alpha blending when applicable.
    – das-g
    Mar 29, 2018 at 11:04
  • 1
    So when having overlapping inputs, gdal_translate might not give the desired result.
    – das-g
    Mar 29, 2018 at 11:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.