viewof map = {
let container = html`<div style='height:800px;' />`;
yield container;
let map = new mapboxgl.Map({
container,
center: [24.35271144900878, -0.2881516070711143],
zoom: 2.9,
style: "mapbox://styles/highestroad/cla06v2ro000215q9hz8o9mns",
hash: true,
projection: "mercator"
});
map.on("load", () => {
container.value = map;
container.dispatchEvent(new CustomEvent("yearVar"));
map.addLayer(
{
id: "fewsnet-full",
type: "fill",
source: {
type: "vector",
url: "mapbox://highestroad.6bg98zhz",
tolerance: 0.0
},
"source-layer": "all_full_simple",
layout: {},
filter: [
"all",
["match", ["get", "year"], [selectedDate.slice(0, 4)], true, false],
["match", ["get", "month"], [selectedDate.slice(5, 7)], true, false]
],
paint: {
"fill-color": [
"match",
["get", "CS"],
[1],
"#c6f9c6",
[2],
"#f9e21c",
[3],
"#e26d00",
[4],
"#c10000",
[5],
"#551010",
"hsla(0, 0%, 100%, 0)"
],
"fill-opacity": 0.6
}
},
"mapbox-mapbox-terrain-dem-v1"
);
});
}