mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
specification revision to v2 [#27]
This commit is contained in:
@@ -55,14 +55,14 @@ A PMTiles archive is composed of:
|
|||||||
|
|
||||||
### Header
|
### Header
|
||||||
* The header begins with a 2-byte magic number, "PM"
|
* The header begins with a 2-byte magic number, "PM"
|
||||||
* Followed by 2 bytes, the PMTiles specification version (currently 1)
|
* Followed by 2 bytes, the PMTiles specification version (currently 2).
|
||||||
* Followed by 4 bytes, the length of metadata (M bytes)
|
* Followed by 4 bytes, the length of metadata (M bytes)
|
||||||
* Followed by 2 bytes, the number of entries in the *root directory* (N entries)
|
* Followed by 2 bytes, the number of entries in the *root directory* (N entries)
|
||||||
* Followed by M bytes of metadata, by convention a JSON object
|
* Followed by M bytes of metadata, which **must be a JSON string with bounds, minzoom and maxzoom properties (new in v2)**
|
||||||
* Followed by N * 17 bytes, the root directory.
|
* Followed by N * 17 bytes, the root directory.
|
||||||
|
|
||||||
### Directory structure
|
### Directory structure
|
||||||
A directory is a contiguous sequence of 17 byte entries. A directory can have at most 21,845 entries.
|
A directory is a contiguous sequence of 17 byte entries. A directory can have at most 21,845 entries. **A directory must be sorted by Z, X and then Y order (new in v2).**
|
||||||
|
|
||||||
An entry consists of:
|
An entry consists of:
|
||||||
* 1 byte: the zoom level (Z) of the entry, with the top bit set to 1 instead of 0 to indicate the offset/length points to a leaf directory and not a tile.
|
* 1 byte: the zoom level (Z) of the entry, with the top bit set to 1 instead of 0 to indicate the offset/length points to a leaf directory and not a tile.
|
||||||
@@ -71,6 +71,8 @@ An entry consists of:
|
|||||||
* 6 bytes: the offset of where the tile begins in the archive.
|
* 6 bytes: the offset of where the tile begins in the archive.
|
||||||
* 4 bytes: the length of the tile, in bytes.
|
* 4 bytes: the length of the tile, in bytes.
|
||||||
|
|
||||||
|
**All leaf directory entries follow non-leaf entries. All leaf directories in a single directory must have the same Z value. (new in v2).**
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
* A full directory of 21,845 entries holds exactly a complete pyramid with 8 levels, or 1+4+16+64+256+1024+4096+16384.
|
* A full directory of 21,845 entries holds exactly a complete pyramid with 8 levels, or 1+4+16+64+256+1024+4096+16384.
|
||||||
* A PMTiles archive with less than 21,845 tiles should have a root directory and no leaf directories.
|
* A PMTiles archive with less than 21,845 tiles should have a root directory and no leaf directories.
|
||||||
|
|||||||
Reference in New Issue
Block a user