labels above data
Some checks are pending
Verify Latest Dependencies / Verify Latest Dependencies (push) Waiting to run
build and test / wxbox - latest (push) Waiting to run

This commit is contained in:
TerraMaster85 2025-05-17 22:11:07 -04:00
parent b1ad04f45f
commit 3b552bd890

View file

@ -55,6 +55,18 @@
load_image('radar-rect-green');
load_image('radar-rect-red');
// should this be here? am unfamiliar with the structure
const layers = map.getStyle().layers;
let sym_layer;
for (let i = 0; i < layers.length; i++) {
if (layers[i].type === 'symbol') {
sym_layer = layers[i].id;
break;
}
}
map.addSource('alerts', {
type: 'geojson',
data: 'https://api.weather.gov/alerts/active?status=actual'
@ -67,7 +79,7 @@
// @ts-expect-error this type is too complicated
'fill-color': fillLUT,
}
});
}, sym_layer);
map.addLayer({
id: 'alerts-outline',
type: 'line',
@ -80,7 +92,7 @@
'line-color': borderLUT,
'line-width': 3
}
});
}, sym_layer);
let createPopup = (e, full: boolean) => {
const randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
const uniqid = randLetter + Date.now();
@ -98,7 +110,7 @@
}
});
};
map.on('click', 'alerts', (e) => {createPopup(e,true)});
map.on('click', 'alerts', (e) => { createPopup(e, true) });
let currentFeatureCoordinates = undefined;
const popup = new maplibregl.Popup({
closeButton: false,