Skip to content

Commit

Permalink
Reconcile with some of Paul's wording
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Jan 22, 2018
1 parent d2f5b1f commit 684a518
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
32 changes: 23 additions & 9 deletions 1.3/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,33 @@ MBTiles is a specification for storing tiled map data in
MBTiles files, known as **tilesets**, MUST implement the specification below
to ensure compatibility with devices.

## Compatibility

*This section is informative and does not add requirements to implementations.*

Because views may be used to produce the MBTiles schema, two implementations
may store tiles with different internal details, meaning one implementation
may not be able to add to an existing file.

As a container format, MBTiles can store any tiled data, so data can be stored
that an implementation cannot do anything with.

Relying on metadata keys not defined in the specification can cause
compatibility problems.

## Database Specifications

Tilesets MUST be valid SQLite databases of
Tilesets SHALL be valid SQLite databases of
[version 3.0.0](http://sqlite.org/formatchng.html) or higher.
Only core SQLite features are permitted; tilesets MUST NOT require extensions.
Only core SQLite features are permitted; tilesets SHALL NOT require extensions.

MBTiles databases SHOULD use [the officially assigned magic number](http://www.sqlite.org/src/artifact?ci=trunk&filename=magic.txt)
MBTiles databases MAY use [the officially assigned magic number](http://www.sqlite.org/src/artifact?ci=trunk&filename=magic.txt)
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.
SQLite views that produce compatible results MAY be used instead.
For convenience, this specification refers to tables and virtual
tables (views) as tables.

Expand All @@ -49,7 +63,7 @@ The metadata table is used as a key/value store for settings. It MUST contain th
* `name` (string): The human-readable name of the tileset.
* `format` (string): The file format of the tile data: `pbf`, `jpg`, `png`, or an [IETF media type](https://www.iana.org/assignments/media-types/media-types.xhtml) for other formats.

`pbf` here refers to gzip-compressed vector tile data in
`pbf` as a `format` refers to gzip-compressed vector tile data in
[Mapbox Vector Tile](https://github.com/mapbox/vector-tile-spec/) format.

The `metadata` table SHOULD contain these four rows:
Expand Down Expand Up @@ -104,9 +118,9 @@ The `zoom_level`, `tile_column`, and `tile_row` columns MUST encode the location
of the tile, following the
[Tile Map Service Specification](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification),
with the restriction that
**the [global-mercator](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-mercator) (aka Spherical Mercator) profile is assumed**.
the [global-mercator](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-mercator) (aka Spherical Mercator) profile MUST be used.

Note that in the TMS tiling scheme, the Y axis is reversed from the coordinate system commonly used in the URLs
Note that in the TMS tiling scheme, the Y axis is reversed from the "XYZ" coordinate system commonly used in the URLs
to request individual tiles, so the tile commonly referred to as 11/327/791 is inserted as
`zoom_level` 11, `tile_column` 327, and `tile_row` 1256, since 1256 is 2^11 - 1 - 791.

Expand Down Expand Up @@ -137,9 +151,9 @@ A typical create statement for the `grid_data` table:

#### Content

The `grids` table contains UTFGrid data, compressed in `gzip` format.
The `grids` table, if present, MUST contain UTFGrid data, compressed in `gzip` format.

The `grid_data` table contains grid key to value mappings, with values encoded
The `grid_data` table, if present, MUST contain grid key to value mappings, with values encoded
as JSON objects.

## Vector tileset metadata
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MBTiles Specification

MBTiles is a specification for storing tiled map data in
MBTiles is a specification for storing arbitrary tiled map data in
[SQLite](http://sqlite.org/) databases for immediate usage and for efficient transfer.
MBTiles files, known as **tilesets**, must implement the specification below
to ensure compatibility with devices.
Expand All @@ -15,29 +15,29 @@ to ensure compatibility with devices.
# 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 -
tiled data, including vector or 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
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.
and Rasterlite, MBTiles is not raw data storage. It is storage
for tiled 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.
of interactivity data. Multiple tilesets (layers, or maps in other
terms) can be represented by multiple MBTiles files.

## UTFGrid

The MBTiles specification previously contained the
[UTFGrid specification](https://github.com/mapbox/utfgrid-spec).
It was removed in version 1.2 and moved into its own specification
with synced version numbers - so MBTiles 1.2 is compatible with
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.

Expand Down

0 comments on commit 684a518

Please sign in to comment.