MBTiles

MBTiles Specification

MBTiles is a specification for storing tiled map data in SQLite databases for immediate usage and for transfer. MBTiles files, known as tilesets, must implement the specification below to ensure compatibility with devices.

UTFGrid

The MBTiles specification previously contained the UTFGrid specification. It was removed in version 1.2 and moved into its own specification with synced version numbers - so MBTiles 1.2 is compatible with UTFGrid 1.2. The specs integrate but do not require each other for compliance.

Versions

  • Development - NOT USABLE: 1.2
  • Stable: 1.1
  • 1.0

Changelog

Roadmap

  • The format will switch tile ordering to the XYZ schema popularized by OpenStreetMap and away from the Tile Map Service specification.

1.1

  • name='format' row required in metadata table.
  • name='bounds' row suggested in metadata table.
  • optional UTFGrid-based interaction spec.

Concept

MBTiles is a compact, restrictive specification. It supports only tiled data, including image tiles and interactivity grid tiles. Only the Spherical Mercator projection is supported for presentation - tile display - and only latitude-longitude coordinates are supported for metadata such as bounds and centers.

It is a minimum specification - only specifying the ways in which data must be retrievable. Thus MBTiles files can internally compress and optimize data, and construct views that adhere to the MBTiles specification.

Unlike Spatialite, GeoJSON, and Rasterlite, MBTiles is not raw data storage - it is storage for presentational data, like rendered map tiles.

One MBTiles file represents a single tileset, optionally including grids of interactivity data. Multiple tilesets - layers, or maps in other terms, can be represented by multiple MBTiles files.

Implementations.

License

The text of this specification is licensed under a Creative Commons Attribution 3.0 United States License. However, the use of this spec in products and code is entirely free: there are no royalties, restrictions, or requirements.

Authors

  • Tom MacWright (tmcw)
  • Will White (willwhite)
  • Konstantin Kaefer (kkaefer)
  • Justin Miller (incanus)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

MBTiles 1.2

Sub-sections:

  • Interaction: HTTP endpoints needed for implementing interactivity
  • UTFGrid: This specification relies on UTFGrid 1.2 for interactivity.

Abstract

MBTiles is a specification for storing tiled map data in SQLite databases for immediate usage and for transfer. MBTiles files, known as tilesets, must implement the specification below to ensure compatibility with devices.

Database Specifications

Tilesets are expected to be valid SQLite databases of version 3.0.0 or higher. Only core SQLite features are permitted; tilesetscannot require extensions.

MBTiles databases can optionally use the officially assigned magic number to be easily identified as MBTiles.

Database

Note: the schemas outlined are meant to be followed as interfaces. SQLite views that produce compatible results are equally valid. For convenience, this specification refers to tables and virtual tables (views) as tables.

Metadata
Schema

The database is required to contain a table or view named metadata.

This table must yield exactly two columns named name and value. A typical create statement for the metadata table:

CREATE TABLE metadata (name text, value text);
Content

The metadata table is used as a key/value store for settings. Five keys are required:

  • name: The plain-english name of the tileset.
  • type: overlay or baselayer
  • version: The version of the tileset, as a plain number.
  • description: A description of the layer as plain text.
  • format: The image file format of the tile data: png or jpg

One row in metadata is suggested and, if provided, may enhance performance.

  • bounds: The maximum extent of the rendered map area. Bounds must define an area covered by all zoom levels. The bounds are represented in WGS:84 - latitude and longitude values, in the OpenLayers Bounds format - left, bottom, right, top. Example of the full earth: -180.0,-85,180,85.
  • attribution: An attribution string, which explains in English (and HTML) the sources of data and/or style for the map.

Several additional keys are supported for tilesets that implement UTFGrid-based interaction.

Tiles
Schema

The database is required to contain a table named tiles.

The table must yield four columns named zoom_level, tile_column, tile_row, and tile_data. A typical create statement for the tiles table:

CREATE TABLE tiles (zoom_level integer, tile_column integer, tile_row integer, tile_data blob);
Content

The tiles table contains tiles and the values used to locate them. The zoom_level, tile_column, and tile_row columns follow the Tile Map Service Specification in their construction, but in a restricted form:

The global-mercator (aka Spherical Mercator) profile is assumed

The tile_data blob column contains raw image data in binary.

A subset of image file formats are permitted:

  • png
  • jpg
Grids

See the UTFGrid specification for implementation details of grids and interaction metadata itself: the MBTiles specification is only concerned with storage.

Schema

The database can have optional tables named grids, grid_data.

The grids table must yield four columns named zoom_level, tile_column, tile_row, and grid. A typical create statement for the grids table:

CREATE TABLE grids (zoom_level integer, tile_column integer, tile_row integer, grid blob);

The grid_data table must yield five columns named zoom_level, tile_column, tile_row, key_name, and key_json. A typical create statement for the grid_data table:

CREATE TABLE grid_data (zoom_level integer, tile_column integer, tile_row integer, key_name text, key_json text);
Content

The grids table contains UTFGrid data, gzip compressed.

The grid_data table contains grid key to value mappings, with values encoded as JSON objects.

 

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Implementations

Brendan Ward edited this page on Sep 8 · 65 revisions

<?XML:NAMESPACE PREFIX = "[default] http://www.w3.org/2000/svg" NS = "http://www.w3.org/2000/svg" />Pages 1
Clone this wiki locally

Clone in Desktop

1.1 Compliant

Others

Applications

Websites

posted @ 2016-12-18 20:36  ParamousGIS  阅读(1783)  评论(0编辑  收藏  举报