The MBTiles format makes it easy to manage and share thousands or even millions of map tiles.
MBTiles is a specification for storing tiled map data in SQLite databases for immediate use and for transfer. The files are designed for portability of thousands, hundreds of thousands, or even millions of standard map tile images in a single file.
Of course not. You can always turn an MBTiles file into a directory of normal images by using mbutil. MBTiles is a very simple SQLite schema for storing normal images: it's not complex or proprietary.
You'll either need a server, or be using the tiles on a device like an iPad. All that a server needs to do is pull individual tiles out of an MBTiles file and serve them to your browser: browsers aren't capable of reading the SQLite format that defines MBTiles files.
No: MapBox Hosting stores an MBTiles file and serves individual tiles from it. An average user will only consume a few megabytes of bandwidth from actively using a map. The full size of an MBTiles tileset, whether it's 10MB or 2GB, is never actually transferred unless the user wants to download it to use it in the MapBox iPad app offline.
Originally we managed tilesets on S3, but came up with MBTiles because
of the massive management and efficiency problems that this posed. S3 is extremely
slow for transfering millions of tiny files because each file needs to be a separate
request with lots of communication overhead. When you want to move tiles - for instance,
in renaming a tileset from world-light to world there is no
batch-rename: you need to rename every file individually. In our experience,
operations like deleting tilesets, changing their name, and updating them
were extremely slow given these constraints - often an overnight task.
For instance, the Geography Class tileset is 205MB as an MBTiles file, but 800MB when you export it into images files with mbutil.
Most filesystems are terribly inefficient for millions of small files, and MBTiles can constitute a massive space savings, just by managing them better. Copying files - which requires building a filesystem node - tends to be very slow, and high zoom levels can run against inode limits - from which there is no recourse.
You can compress tilesets by linking similar tiles together - for instance, all blank blue tiles for sea area can be the same image. MBTiles makes this optimization internally and keeps it consistent even if you move the tileset around. Doing this with symlinks and other filesystem constructs is difficult or impossible across systems.
Download the Haiti Terrain Grey tileset. Then, open the MBTiles file in the sqlite client.
sqlite3 haiti-terrian-grey.mbtiles
Next, run this SQL statment.
SELECT * FROM tiles WHERE zoom_level = 5;
This displays a row for each tile on zoom level five.
5|8|17|????
5|8|18|????
5|9|17|????
5|9|18|????
5|10|17|????
5|10|18|????
The ???? characters represents PNG images stored as blob data.