Files
PMTiles/js
2022-10-17 23:23:38 +08:00
..
2022-02-17 13:31:17 +08:00
2022-10-17 23:23:38 +08:00
2022-10-17 21:20:37 +08:00
2022-10-17 21:20:37 +08:00
2022-10-14 00:10:54 +08:00
2022-10-17 23:23:38 +08:00

PMTiles

the PMTiles package can be included via script tag or ES6 module.

Leaflet

Raster tileset

Example of a raster PMTiles archive displayed in Leaflet:

const p = new pmtiles.PMTiles('example.pmtiles')
pmtiles.leafletRasterLayer(p,{attribution:'© <a href="https://openstreetmap.org">OpenStreetMap</a>'}).addTo(map)

Vector tileset

See protomaps.js

MapLibre GL JS

Example of a PMTiles archive displayed in MapLibre GL JS:

let protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
var style = {
"version": 8,
"sources": {
    "example_source": {
        "type": "vector",
        "url": "pmtiles://https://example.com/example.pmtiles",
        "attribution": '© <a href="https://openstreetmap.org">OpenStreetMap</a>'
    ...