Skip to content

Copying, Diffing, and Patching MBTiles

mbtiles copy

Copy command copies an mbtiles file, optionally filtering its content by zoom levels.

mbtiles copy src_file.mbtiles dst_file.mbtiles \
        --min-zoom 0 --max-zoom 10

This command can also be used to generate files of different supported schema.

mbtiles copy normalized.mbtiles dst.mbtiles \
         --dst-type flat-with-hash

The destination hashes its tiles with the source's hash algorithm, or with the one --hash-algorithm names.

mbtiles copy src.mbtiles dst.mbtiles \
         --dst-type flat-with-hash --hash-algorithm xxh3

Merging several files

copy takes any number of source files before the destination and copies them into it one after another. Two sources can hold the same tile, so --on-duplicate is required to say which one wins. --diff-with-file and --apply-patch take exactly one source.

mbtiles copy north.mbtiles south.mbtiles merged.mbtiles --on-duplicate override

mbtiles copy --diff-with-file

This option is identical to using mbtiles diff .... The following commands two are equivalent:

mbtiles diff file1.mbtiles file2.mbtiles diff.mbtiles

mbtiles copy file1.mbtiles diff.mbtiles \
        --diff-with-file file2.mbtiles

mbtiles copy --apply-patch

Copy a source file to destination while also applying the diff file generated by copy --diff-with-file command above to the destination mbtiles file. This allows safer application of the diff file, as the source file is not modified.

mbtiles copy src_file.mbtiles dst_file.mbtiles \
        --apply-patch diff.mbtiles