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: [-70.2568, 43.6591], zoom: 13,
style: "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
scrollZoom: true
});
map.addControl(new maplibregl.NavigationControl());
map.setMinZoom(10);
map.setMaxZoom(15);
map.on('load', () => {
map.addSource("contour-source", {
type: "vector",
tiles: [
demSource.contourProtocolUrl({
multiplier: 3.28084,
thresholds: {
10: 5,
11: 5,
12: 5,
13: 5,
14: 5,
15: 5,
},
contourLayer: "contours",
elevationKey: "ele",
levelKey: "level",
extent: 4096,
buffer: 1,
}),
],
maxzoom: 15,
});
map.addLayer({
id: "contour-lines",
type: "line",
source: "contour-source",
"source-layer": "contours",
paint: {
"line-color": "rgba(0,0,0, 50%)",
"line-width": ["match", ["get", "level"], 1, 1, 0.5],
},
});
})
resolve(map);
invalidation.then(() => map.remove());
}