JS cleanup (#640)

* JS cleanup

* remove unused function
* leaflet: properly clean up object URLs
* maplibre: refactor tile type detection
* update leaflet raster example
This commit is contained in:
Brandon Liu
2026-02-10 19:07:24 -05:00
committed by GitHub
parent 46b5e9c716
commit 36bb8046b5
3 changed files with 6 additions and 23 deletions

View File

@@ -15,17 +15,16 @@
<body>
<div id="map"></div>
<script type="text/javascript">
const map = L.map("map").setView([0, 0], 0);
const map = L.map("map");
const p = new pmtiles.PMTiles(
"https://pmtiles.io/stamen_toner(raster)CC-BY+ODbL_z3.pmtiles"
"https://air.mtn.tw/flowers.pmtiles"
);
p.getHeader().then((h) => {
let layer = pmtiles.leafletRasterLayer(p, {
maxzoom: h.maxZoom,
attribution:
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.',
maxNativeZoom: h.maxZoom
});
map.fitBounds(L.latLngBounds([h.minLat, h.minLon],[h.maxLat, h.maxLon]));
layer.addTo(map);
});
</script>