Update README.md

This commit is contained in:
Brandon Liu
2021-03-31 23:08:42 +08:00
committed by GitHub
parent 3eb9560c31
commit 62353d5d2c

View File

@@ -7,6 +7,28 @@ PMTiles is a single-file archive format for tiled data. A PMTiles archive can be
See also: See also:
* [Cloud Optimized GeoTIFFs](https://www.cogeo.org) * [Cloud Optimized GeoTIFFs](https://www.cogeo.org)
## How To Use
Python library: `pip install pmtiles`
pmtiles-convert TILES.mbtiles TILES.pmtiles
pmtiles-convert TILES.pmtiles DIRECTORY
pmtiles-show TILES.pmtiles // see info about a PMTiles directory
pmtiles-serve TILES.pmtiles // start an HTTP server that decodes PMTiles into traditional Z/X/Y paths
See https://github.com/protomaps/PMTiles/tree/master/python/bin for library usage
JavaScript usage:
Include the script:
<script src="https://unpkg.com/pmtiles@0.0.4/pmtiles.js"></script>
Example of a raster PMTiles archive decoded and displayed in Leaflet:
const p = new pmtiles.PMTiles('osm_carto.pmtiles',{allow_200:true})
p.leafletLayer({attribution:'© <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}).addTo(map)
## Specification ## 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. 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.
@@ -15,6 +37,7 @@ A detailed specification is forthcoming. PMTiles is a binary serialization forma
* Directories are recursive, with a maximum of 21,845 entries per directory. * 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* * *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. * Deduplication of tile data is handled by multiple entries pointing to the same offset in the archive.
* The order of tile data in the archive is unspecified; an optimized implementation should arrange tiles on a 2D space-filling curve.
### Details ### Details
* The first 512 kilobytes of a PMTiles archive are reserved, and contain the headers as well as a root directory. * The first 512 kilobytes of a PMTiles archive are reserved, and contain the headers as well as a root directory.