Skip to content

MBTiles information and metadata

summary

Use mbtiles summary to get a summary of the contents of an MBTiles file. The command will print a table with the number of tiles per zoom level, the size of the smallest and largest tiles, and the average size of tiles at each zoom level. The command will also print the bounding box of the covered area per zoom level.

# Create a sample .mbtiles file in some dir
sqlite3 target/world_cities.mbtiles < tests/fixtures/mbtiles/world_cities.sql
# Get mbtiles summary
mbtiles summary target/world_cities.mbtiles

MBTiles file summary for tests/fixtures/mbtiles/world_cities.mbtiles
Schema: flat
File size: 48.00kB
Page size: 4.00kB
Page count: 12

 Zoom |   Count   | Smallest  |  Largest  |  Average  | Bounding Box
    0 |         1 |     1.0kB |     1.0kB |    1.0kB | -180,-85,180,85
    1 |         4 |      160B |      650B |      366B | -180,-85,180,85
    2 |         7 |      137B |      495B |      239B | -180,-67,180,67
    3 |        17 |       67B |      246B |      134B | -135,-41,180,67
    4 |        38 |       64B |      175B |       86B | -135,-41,180,67
    5 |        57 |       64B |      107B |       72B | -124,-41,180,62
    6 |        72 |       64B |       97B |       68B | -124,-41,180,62
  all |       196 |       64B |     1.0kB |       96B | -180,-85,180,85

meta-all

Print all metadata values to stdout, as well as the results of tile detection. The format of the values printed is not stable, and should only be used for visual inspection.

mbtiles meta-all my_file.mbtiles

meta-get

Retrieve raw metadata value by its name. The value is printed to stdout without any modifications. For example, to get the description value from an mbtiles file:

mbtiles meta-get my_file.mbtiles description

meta-set

Set metadata value by its name, or delete the key if no value is supplied. For example, to set the description value to A vector tile dataset:

mbtiles meta-set my_file.mbtiles description "A vector tile dataset"

meta-update

Update minzoom, maxzoom and compression to match the tiles in the file. Use --set-meta and --delete-meta to set or delete other values in the same step. They apply after the computed values, so they can override them. Both flags can be repeated, and a key cannot be both set and deleted. They change the stored values that meta-get returns. meta-all and Martin never report a minzoom above the lowest zoom that has tiles, or a maxzoom above the highest.

mbtiles meta-update my_file.mbtiles --set-meta minzoom=3 --delete-meta bounds