From 5525958bea2cc34a3a283f3cd9b29f989db7993c Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Fri, 18 Feb 2022 13:00:53 +0800 Subject: [PATCH] README link version 1.0.0 [#18] --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9464255..3b9a640 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,25 @@ See https://github.com/protomaps/PMTiles/tree/master/python/bin for library usag ### JavaScript - + -Example of a raster PMTiles archive decoded and displayed in Leaflet: +Example of a raster PMTiles archive displayed in Leaflet: + + const p = new pmtiles.PMTiles('example.pmtiles') + pmtiles.leafletLayer(p,{attribution:'© OpenStreetMap contributors'}).addTo(map) + +Example of a vector PMTiles archive displayed in MapLibre GL JS: + + let cache = new pmtiles.ProtocolCache(); + maplibregl.addProtocol("pmtiles",cache.protocol); + var style = { + "version": 8, + "sources": { + "example_source": { + "type": "vector", + "tiles": ["pmtiles://example.pmtiles/{z}/{x}/{y}"], + ... - const p = new pmtiles.PMTiles('osm_carto.pmtiles',{allow_200:true}) - p.leafletLayer({attribution:'© OpenStreetMap contributors'}).addTo(map) ## Specification