mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
add leaflet demo with osm carto raster tiles, pass leaflet options
This commit is contained in:
@@ -17,14 +17,9 @@
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<script>
|
||||
const map = L.map('map')
|
||||
const ready = metadata => {
|
||||
map.options.maxZoom = +metadata.maxzoom
|
||||
const b = metadata.bounds.split(',')
|
||||
map.fitBounds([[+b[1],+b[0]],[+b[3],+b[2]]],{maxZoom:+metadata.maxzoom})
|
||||
}
|
||||
const p = new pmtiles.PMTiles('http://localhost:8500/example.pmtiles',ready);
|
||||
p.leafletLayer().addTo(map)
|
||||
const map = L.map('map',{maxZoom:4}).setView([0,0],0)
|
||||
const p = new pmtiles.PMTiles('osm_carto.pmtiles')
|
||||
p.leafletLayer({attribution:'© <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}).addTo(map)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
examples/osm_carto.pmtiles
Normal file
BIN
examples/osm_carto.pmtiles
Normal file
Binary file not shown.
@@ -178,7 +178,7 @@
|
||||
})
|
||||
},
|
||||
})
|
||||
return new cls()
|
||||
return new cls(options)
|
||||
}
|
||||
}
|
||||
return {PMTiles:PMTiles}
|
||||
|
||||
Reference in New Issue
Block a user