MBTiles is an open specification developed by Mapbox for storing tiled map data in a single SQLite database file. It's widely used in the geospatial industry for offline mapping and mobile applications.
Use a tile server like tileserver-gl or mbtileserver:
# Install tileserver-gl
npm install -g tileserver-gl-light
# Serve the MBTiles file
tileserver-gl-light rgb_tiles.mbtiles
Convert back to individual tile files using mb-util:
# Install mb-util
pip install mbutil
# Extract tiles
mb-util rgb_tiles.mbtiles output_dir/
Many mobile mapping SDKs support MBTiles directly:
Generate MBTiles from a raster using GDAL:
# Step 1: Generate XYZ tiles
gdal2tiles.py -z 7-14 input.tif output_dir/
# Step 2: Convert to MBTiles
mb-util output_dir/ output.mbtiles
| Feature | MBTiles | XYZ Tiles |
|---|---|---|
| File Count | ✓ Single file | ✗ Thousands |
| Offline Use | ✓ Excellent | ~ Possible |
| CDN Caching | ~ Requires server | ✓ Perfect |
| Distribution | ✓ Easy (1 file) | ✗ Complex |