mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
* Make aws/cloudflare depend on pmtiles from npm [#455] This is clearer to developers than relying on the local code being built. * update check_examples.py * bump openlayers to v2 with upgrade of pmtiles to v4 [#455] * update to 4.2.1
40 lines
1.2 KiB
HTML
40 lines
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<title>PMTiles OpenLayers Raster Example</title>
|
|
<meta charset="utf-8"/>
|
|
<script src="https://cdn.jsdelivr.net/npm/ol@v9.0.0/dist/ol.js"></script>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v9.0.0/ol.css">
|
|
<script src="https://unpkg.com/ol-pmtiles@2.0.0/dist/olpmtiles.js"></script>
|
|
<style>
|
|
body, #map {
|
|
height:100vh;
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="map"></div>
|
|
<script type="text/javascript">
|
|
const rasterLayer = new ol.layer.WebGLTile({
|
|
source: new olpmtiles.PMTilesRasterSource({
|
|
url:"https://r2-public.protomaps.com/protomaps-sample-datasets/terrarium_z9.pmtiles",
|
|
attributions:["https://github.com/tilezen/joerd/blob/master/docs/attribution.md"],
|
|
tileSize: [512,512]
|
|
})
|
|
});
|
|
|
|
ol.proj.useGeographic();
|
|
|
|
const map = new ol.Map({
|
|
layers: [rasterLayer],
|
|
target: 'map',
|
|
view: new ol.View({
|
|
center: [0,0],
|
|
zoom: 1,
|
|
multiWorld: true
|
|
}),
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|