Introduction
MBTiles is a format for a set of map tiles in a single file, created by Mapbox. Web maps are drawn from small square tiles, one set for each zoom level, and a whole region can need millions of them. Keeping them in one file makes a tile set easy to copy, to serve and to use offline in mobile apps.
The tiles can be images, PNG, JPEG or WebP, or vector tiles, which hold the map’s shapes and are styled when they are drawn.
Structure
An MBTiles file is an SQLite 3 database, so it
starts with SQLite format 3. It has two parts:
- a
metadatatable ofnameandvaluepairs, giving the tile set’s name, format (such aspngorpbf), bounds, centre and zoom levels; for vector tiles ajsonentry lists the layers - a
tilestable with the columnszoom_level,tile_column,tile_rowandtile_data, the tile itself as a blob
Rows are numbered from the bottom of the map, in the TMS scheme, so the row is flipped
compared with the usual web map numbering. Vector tiles are stored gzip-compressed.
Many files make tiles a view over other tables so that identical tiles,
such as open sea, are stored only once.
Links
Software
- QGIS (Windows, macOS, Linux)
- Tippecanoe, which builds vector tile sets from GeoJSON
- TileServer GL, which serves tiles from MBTiles files
Developers
- GDAL, C and C++, with an MBTiles driver
Reference
- MBTiles specification, Mapbox