@@ -50,5 +60,39 @@
}
window.onload = api;
+
+ var mymap = L.map('mapid').setView([67.8488, 20.3027], 6);
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ maxZoom: 19,
+ attribution: '©
OpenStreetMap'
+ }).addTo(mymap);
+ var kiruna = L.marker([67.8488, 20.3027]).addTo(mymap);
+ kiruna.bindPopup("Kiruna");
+ var abisko = L.marker([68.35, 18.8166]).addTo(mymap);
+ abisko.bindPopup("Abisko");
+
+ async function clouds(){
+ const valTime = await fetch('https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/validtime.json');
+ const times = await valTime.json();
+ var time = times.validTime[1].replace(/-/g, "").replace(/:/g, "");
+ document.getElementById('clouds').textContent = "Cloud Coverage Forcast for " + times.validTime[1].replace(/T/g, " ").replace(/Z/g, " UTC");
+ const res = await fetch(`https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/multipoint/validtime/${time}/parameter/tcc_mean/leveltype/hl/level/0/data.json`);
+ const data = await res.json();
+
+ for(i=0; i