Skip to content

Commit

Permalink
Line-breaking 1.1 spec, expanding README
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Sep 8, 2011
1 parent 3e612ff commit 54b5f36
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 10 deletions.
33 changes: 25 additions & 8 deletions 1.1/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,32 @@

## Abstract

MBTiles is a specification for storing tiled map data in [SQLite](http://sqlite.org/) databases for immediate usage and for transfer. MBTiles files, known as **tilesets**, must implement the specification below to ensure compatibility with devices.
MBTiles is a specification for storing tiled map data in
[SQLite](http://sqlite.org/) 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](http://sqlite.org/formatchng.html) or higher. Only core SQLite features are permitted; tilesets **cannot require extensions**.
Tilesets are expected to be valid SQLite databases of
[version 3.0.0](http://sqlite.org/formatchng.html) or higher.
Only core SQLite features are permitted; tilesets **cannot require extensions**.

## 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.
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:
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);

Expand All @@ -39,23 +48,31 @@ The metadata table is used as a key/value store for settings. Five keys are **re

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`.
* `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`.

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

### 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:
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](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification) in their construction, but in a restricted form:
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](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification) in
their construction, but in a restricted form:

* **The [global-mercator](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-mercator) (aka Spherical Mercator) profile is assumed**

Expand Down
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,62 @@
# MBTiles Specification

MBTiles is a specification for storing tiled map data in [SQLite](http://sqlite.org/) databases for immediate usage and for transfer. MBTiles files, known as **tilesets**, must implement the specification below to ensure compatibility with devices.
MBTiles is a specification for storing tiled map data in
[SQLite](http://sqlite.org/) databases for immediate usage and for transfer.
MBTiles files, known as **tilesets**, must implement the specification below
to ensure compatibility with devices.

# Versions

* In-progress / unstable: [2.0](https://github.com/mapbox/mbtiles-spec/blob/master/2.0/spec.md)
* **Stable**: [1.1](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/spec.md)
* [1.0](https://github.com/mapbox/mbtiles-spec/blob/master/1.0/spec.md)

# 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](http://www.gaia-gis.it/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

[Implementing software is tracked on the Wiki](https://github.com/mapbox/mbtiles-spec/wiki/Implementations).

# License

The text of this specification is licensed under a
[Creative Commons Attribution 3.0 United States License](http://creativecommons.org/licenses/by/3.0/us/).
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)

0 comments on commit 54b5f36

Please sign in to comment.