From df28516e4bc2ed352728e86aa23bf1762d3bf986 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Wed, 31 Mar 2021 15:16:53 +0800 Subject: [PATCH 1/3] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8aa3568..b0ce1cc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ PMTiles is a single-file archive format for tiled data. A PMTiles archive can be hosted on a commodity storage platform such as S3, and enables low-cost, zero-maintenance map applications that are "serverless" - free of a custom tile backend or third party provider. +[Demo](https://protomaps.github.io/PMTiles/examples/leaflet.html) - watch your network request log + See also: * [Cloud Optimized GeoTIFFs](https://www.cogeo.org) From 16dfb5e7a8a9c508b56ec1e6a293ca7b527d85ce Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Wed, 31 Mar 2021 15:35:41 +0800 Subject: [PATCH 2/3] high level overview of spec --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index b0ce1cc..c49d346 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,32 @@ PMTiles is a single-file archive format for tiled data. A PMTiles archive can be See also: * [Cloud Optimized GeoTIFFs](https://www.cogeo.org) +## Specification + +A detailed specification is forthcoming. PMTiles is a binary serialization format designed for two main access patterns: over the network, via HTTP 1.1 Byte Serving (`Range:` requests), or via memory-mapped files on disk. + +### Design considerations +* Directories are recursive, with a maximum of 21,845 entries per directory. +* Deduplication of tile data is handled by multiple entries pointing to the same offset in the archive. + +### Details +* The first 512 kilobytes of a PMTiles archive are reserved, and contain the headers as well as a root directory. +* All integer values are little-endian. +* The headers begin with a magic number, "PM" +* 2 bytes: which specify the PMTiles specification version, right now always 1. +* 4 bytes: the length of metadata (M bytes) +* 2 bytes: the number of entries in the root directory (N) +* M bytes: the metadata, by convention a JSON object. +* N * 17 bytes: the root directory. + +### Directory structure + +A directory is a sequence of 17 byte entries. 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 data is a child directory, not data. +* 3 bytes: the X (column) of the entry. +* 3 bytes: the Y (row) of the entry. +* 6 bytes: the offset of where the tile begins in the archive. +* 4 bytes: the length of the data. ## License From 86222c99e98012c96e1b594524b323e96a3edde8 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Wed, 31 Mar 2021 17:51:00 +0800 Subject: [PATCH 3/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c49d346..f7db625 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ A detailed specification is forthcoming. PMTiles is a binary serialization forma ### Design considerations * Directories are recursive, with a maximum of 21,845 entries per directory. + * *21845 is the total tiles of a pyramid with 7 levels, or 1+4+16+64+256+1024+4096+16384* * Deduplication of tile data is handled by multiple entries pointing to the same offset in the archive. ### Details