Monday 5 June 2017

gdal - What's the difference between gdalwarp and gdal_merge for mosaicing


I wanted to merge around 20 dem tiffs each around 100MB, and I used gdalwarp (I know about virtual file option):


gdalwarp $(list_of_tiffs) merged.tiff


However this command took very long time, and after some 15min it was processing 5th image from set. I terminate it.


I then found that gdal_merge.py script can be used also for mosaicing, and tried it:


gdal_merge.py $(list_of_tiffs)



which completed in less then 3min.


As I expected that both commands would produce same result, I wonder what's the difference between the two, as to why gdalwarp takes so much time if result is same?



Answer



While I don't know why GDAL provides this overlap in functionality, be sure to set the cache for gdalwarp to make it really fast:


# assuming 3G of cache here:
gdalwarp --config GDAL_CACHEMAX 3000 -wm 3000 $(list_of_tiffs) merged.tiff

Be sure to not define more cache than having RAM on the machine.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...