I have several .mbtiles
with no (or little) overlapping areas and I would like to merge them into one file in order to be able to serve them more easily.
I'm looking for a command line tool that can do this.
tile-join seems to work only on vector tiles. When I run to on my raster tiles it crashes:
tile-join first.mbtiles second .mbtiles -o combined.mbtiles
libc++abi.dylib: libc++abi.dylib: libc++abi.dylib: libc++abi.dylib: libc++abi.dylib: terminating with uncaught exception of type protozero::unknown_pbf_wire_type_exception: unknown pbf field type exceptionterminating with uncaught exception of type protozero::unknown_pbf_wire_type_exception: unknown pbf field type exceptionterminating with uncaught exception of type protozero::unknown_pbf_wire_type_exception: unknown pbf field type exceptionlibc++abi.dylib: terminating with uncaught exception of type protozero::unknown_pbf_wire_type_exception: unknown pbf field type exceptionlibc++abi.dylib: terminating with uncaught exception of type protozero::unknown_pbf_wire_type_exception: unknown pbf field type exception
Abort trap: 6
gdal_merge.py works on .tiff
files but I have .mbtiles
as input.
Update:
I managed to convert the .mbtiles to .tiff using
gdal_translate input.mbtiles output.tiff
gdal_translate input2.mbtiles output2.tiff
Then merge them using
gdal_merge.py -co COMPRESS=LZW *.tiff
This gives me one out.tiff
but then how to get a .mbtiles
back? goal_translate
gives me this error:
gdal_translate -of mbtiles out.tif out.mbtiles
Input file size is 81920, 81920
0ERROR 6: GDALDriver::Create() ... no create method implemented for this format.
any ideas?
gdal_translate -of MBTILES merged.tif output.mbtiles -co ZOOM_LEVEL_STRATEGY=AUTO
should be working starting with gdal version >= 2.1 (though i tested it with gdal 2.3.0) Furthermore you should add some overviews to the file withgdaladdo -r average output.mbtiles 2 4 8 16