viewof map = {
let container = html`<div style='height:600px;' />`;
yield container;
const mapRef = (container.value = new maplibre.Map({
container,
center: { lng: -122.2904968231878, lat: 37.79736860393669 },
zoom: 8.5,
style: TgmClient().basemaps.getGLStyleURL("Light"),
attributionControl: false
}))
.addControl(new maplibre.NavigationControl())
.addControl(
new maplibre.AttributionControl({
compact: true,
customAttribution: attribution
})
);
await new Promise((resolve, reject) => {
mapRef.on("load", async () => {
mapRef.addSource("iso", {
type: "geojson",
data: {
type: "FeatureCollection",
features: []
}
});
mapRef.addLayer({
id: "iso",
type: "fill",
source: "iso",
layout: {},
paint: {
"fill-opacity": 0.25,
"fill-color": "#000"
}
});
resolve();
});
});
invalidation.then(() => mapRef.remove());
yield container;
}