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
and
gdalbuildvrt \
-input_file_list filelist.txt \
$tmpdirname/out.vrt
gdal_translate \
$tmpdirname/out.vrt \
-of GTiff \
$output_file
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?)
gdal_translate
doesn't properly handle alpha / mask / nodata, whilegdal_merge.py
handles them as binary mask andgdalmerge
does proper alpha blending when applicable.gdal_translate
might not give the desired result.