Compare commits

...

5 Commits

Author SHA1 Message Date
xaloc 04a3b8cb82 disable cache 2024-10-14 16:50:41 +02:00
xaloc 72b9c4672b remove window.onload 2023-02-27 14:09:01 +01:00
xaloc ff5942cba1 add temperature map and fix typo 2023-02-14 14:22:19 +01:00
xaloc ac5fea2c64 Fix typo 2022-08-23 11:26:09 +02:00
xaloc f065fa22c2 Change date/time display for cloud coverage forecast 2022-08-23 11:25:46 +02:00
+13 -4
View File
@@ -6,6 +6,7 @@
<meta charset="UTF-8">
<meta name="author" content="Arnau Busom i Vidal">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
@@ -38,9 +39,13 @@
</div>
</div>
<div style="text-align: center;">
<h1 id='clouds'>Cloud Coverage Forcast for the next hour</h1>
<h1 id='clouds'>Cloud Coverage Forecast for the next hour</h1>
<div id="mapid", style="height: 400px; width: 70%; margin: auto;"></div>
</div>
<div style="text-align: center;">
<h1 id='temp'>Current temperature map (in °C)</h1>
<embed src="https://www.temperatur.nu/karta2.php#67.86313,20.20935,8z", id="tempmapid", style="height: 400px; width: 70%; margin: auto;">
</div>
<div style="text-align: center;">
<h1>Aurora Forecast</h1>
<div style="display: inline-block; padding: 10px;">
@@ -82,7 +87,8 @@
document.getElementById('kp_3').textContent = Number(kp_3.toFixed(2));
}
window.onload = api;
//window.onload = api;
api();
var mymap = L.map('mapid').setView([67.8488, 20.3027], 6);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
@@ -98,7 +104,9 @@
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");
var textTime = new Date(times.validTime[1]).toLocaleString("en-GB", {dateStyle: "short", timeStyle: "short"});
var textTimeUTC = new Date(times.validTime[1]).toLocaleTimeString("en-GB", {timeZone: "UTC", timeStyle: "short"});
document.getElementById('clouds').textContent = "Cloud Coverage Forecast for " + textTime + " (" + textTimeUTC+" 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();
@@ -106,7 +114,8 @@
addClouds(data.geometry.coordinates[i][1],data.geometry.coordinates[i][0],data.timeSeries[0].parameters[0].values[i])
}
}
window.onload = clouds;
//window.onload = clouds;
clouds();
function addClouds(lat,lon,opa){
var circle = L.circle([lat, lon], {