I've got a bunch of geotiffs' that I would like to combine into a single geopackage. Using QGIS, I've only managed to export one layer as a geopackage. I've tried merging the layers and created a virtual layer but then QGIS messes up the colors. The raster files are also arranged in a Arcgis Mosaic dataset (file geodatabase) if that is of any help.
Currently, I do the following (which probably isnt the fastest or most efficient way):
- Generate a .txt-file containing the filenames of all the geotiffs (dir /b /s *.tif > list.txt)
- Use gdal_merge to merge all the geotiffs from list.txt into one large geotiff (gdal_merge -pct --optfile list.txt -o new_huge_geotiff.tif)
- Use gdal_translate to convert my new, huge, geotiff into a geopackage (gdal_translate -of GPKG new_huge_geotiff.tif new_tiny_geopackage.gpkg)
- use gdaladdo to build pyramids in my new geopackage, which I guess also could be done in the previous step when creating the geopackage. I'm just such a newbie. (gdaladdo -r cubic -oo tile_format=JPEG new_tiny_geopackage.gpkg 2 4 6 8 16 32 64)
The process of merging all small geotiffs into one huge takes a lot of time - I wish I could just add them all to a geopackage at once. I've tried using --optfile and the generated txt-list but gdal_translate doesnt like that command.