mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
README link version 1.0.0 [#18]
This commit is contained in:
21
README.md
21
README.md
@@ -35,12 +35,25 @@ See https://github.com/protomaps/PMTiles/tree/master/python/bin for library usag
|
|||||||
|
|
||||||
### JavaScript
|
### JavaScript
|
||||||
|
|
||||||
<script src="https://unpkg.com/pmtiles@0.0.4/pmtiles.js"></script>
|
<script src="https://unpkg.com/pmtiles@1.0.0/dist/index.js"></script>
|
||||||
|
|
||||||
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:'© <a href="https://openstreetmap.org">OpenStreetMap</a> 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:'© <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}).addTo(map)
|
|
||||||
|
|
||||||
## Specification
|
## Specification
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user