mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-03-21 22:39:39 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user