viewof map = {
const container = html`<div style="height:600px;">`;
let resolve;
container.value = new Promise(_ => resolve = _);
yield container;
const map = new maplibregl.Map({
boxZoom: true,
pitch: 0,
bearing: 0,
maplibreLogo: true,
container,
center: [-72.8, 43.1], zoom: 10,
style: "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
scrollZoom: true
});
map.addControl(new maplibregl.NavigationControl());
map.setMinZoom(7);
map.setMaxZoom(15);
let bounds = [
[-73.8, 42.5],
[-71.7, 43.6]
];
map.setMaxBounds(bounds);
map.on('load', () => {
map.addSource('vt', {
"type": "image",
"url": "https://pbogden.github.io/webmap.png",
"coordinates": [
[-72.8699937, 43.1636548],
[-72.6942517, 43.1636548],
[-72.6942517, 43.0343442],
[-72.8699937, 43.0343442],
]
});
map.addLayer({
'id': 'vt',
'type': 'raster',
'source': 'vt',
'minzoom': 0,
'maxzoom': 22,
'paint': {'raster-opacity': .5},
})
})
resolve(map);
invalidation.then(() => map.remove());
}