1

I have a large dataset of tif images with external overviews. Is there any way to merge these images to one bigtiff including the overviews? Using vrt and gdal_translate doesn't seem to be working. Cannot build vrt on the ovr files alone, since they are not georeferenced and gdal_merge.py doesn't work either.

I'd rather not build the overviews again, since that's going to be extremely time consuming (weeks likely).

1 Answer 1

0

Depending on the target format that should be possible. See https://gdal.org/drivers/raster/gtiff.html.

COPY_SRC_OVERVIEWS=[YES/NO]: (CreateCopy() only) By setting this to YES (default is NO), the potential existing overviews of the source dataset will be copied to the target dataset without being recomputed. This option is typically used to generate Cloud Optimized Geotiff (starting with GDAL 3.1, the COG – Cloud Optimized GeoTIFF generator driver can be used as a convenient shortcut). If overviews of mask band also exist, provided that the GDAL_TIFF_INTERNAL_MASK configuration option is set to YES, they will also be copied. Note that this creation option will have no effect if general options (i.e. options which are not creation options) of gdal_translate are used. Creation options related to compression are also applied to the output overviews.

Notice that this option is a driver specific creation option -co and therefore it is not documented in the gdal_translate documentation.

I would try first simply

  • to build a vrt from tifs with gdalbuildvrt
  • to create a BigTIFF or COG with gdal_translate by using option -co COPY_SRC_OVERVIEWS=YES

However, merging gives indeed extra challenges. If gdal_translate does not work directly then your plan to build a vrt from ovr files might work but it would require a few more steps. Overviews are indirectly georeferenced because they steal the georeferencing from the main image. You could perhaps write a script that reads the georeferencing of the main images and writes the info permanently into for example PAM files (.aux.xml) so it could be utilized for the .ovr files.

4
  • I tested using vrt + gdal_translate with COPY_SRC_OVERVIEWS=YES, but no luck. It seems that the option is not used when dealing with vrt's. Seems like I have to make my own version of gdal_merge.py, that can merge ovr files also.
    – jfp
    Sep 6, 2022 at 6:24
  • Or it may be that GDAL thinks that the vrt combined from images with overviews does not have overviews itself. Does gdalinfo your.vrt list overviews?
    – user30184
    Sep 6, 2022 at 6:27
  • It does not. Considering that vrt is not a "real" image file I have assumed that gdalinfo would work in non-standard way, and the actual overviews would be used by the application reading the vrt file (qgis, geoserver, depending if the app supports them).
    – jfp
    Sep 6, 2022 at 6:50
  • Right, I suppose that individual overviews work transparently if you open the big vrt with a client like QGIS. The problem is in how to make the 5000 ovr files to work together as one overview for the one merged BigTIFF.
    – user30184
    Sep 6, 2022 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.