map2 = {
let container = DOM.element("div", {
style: `width:${width}px;height:${width / 1.6}px`
});
yield container;
mapboxgl.accessToken =
"pk.eyJ1IjoiYW5kcmVhc3NvbGJlcmciLCJhIjoiY200eGM3NG1oMGU3aTJrcjA3Y2JmczMybiJ9.fwIvTJNYY5Ot0t7k3eyupQ";
const map = new mapboxgl.Map({
container: container,
style: "mapbox://styles/mapbox/light-v10",
center: [10.325053, 63.430515],
zoom: 10.2
});
const greenIconEl = document.createElement("div");
greenIconEl.style.backgroundImage =
"url('http://public-andreassolberg.s3.eu-north-1.amazonaws.com/bee.png')";
greenIconEl.style.width = "64px";
greenIconEl.style.height = "64px";
greenIconEl.style.backgroundSize = "cover";
greenIconEl.style.backgroundPosition = "center";
const redIconEl = document.createElement("div");
redIconEl.style.backgroundImage =
"url('http://public-andreassolberg.s3.eu-north-1.amazonaws.com/empty.png')";
redIconEl.style.width = "64px";
redIconEl.style.height = "64px";
redIconEl.style.backgroundSize = "cover";
redIconEl.style.backgroundPosition = "center";
data
.sort((a, b) => {
if (a.bol === b.bol) return 0;
return a.bol ? 1 : -1;
})
.forEach((k) => {
const el = k.bol
? greenIconEl.cloneNode(true)
: redIconEl.cloneNode(true);
new mapboxgl.Marker({ element: el })
.setLngLat([k.geo[1], k.geo[0]])
.setPopup(
new mapboxgl.Popup({ offset: 25 }).setText(`Kasse ${k.ID}. ${k.Art}`)
)
.addTo(map);
});
}