Clear 15°
Wind 11 km/h S
Pressure 764 mm
Humidity %58
Rise 08:17
Noon 12:56
Set 17:36
Zone 3
async function askWeather() {
console.log(lat, lon);
let u = "https://api.openweathermap.org/data/2.5/weather?"
+"lat="+lat+"&lon="+lon+"&APPID="+accessKey;
hava.innerText = "getting weather"
detay.innerText = ''
gunes.innerText = ''
let data = await toJSON(u)
// fetch(u).then(r => r.json()).then(showWeather)
// }
// function showWeather(data) {
let w = data.weather[0]; showIcon(w.icon)
let celsius = convert(data.main.temp).toFixed(0)
let hh = w.main+" "+celsius+"°", {sys} = data
let yy = data.name+', '+sys.country
hava.innerText = hh; yer.innerText = yy
lat = data.coord.lat; lon = data.coord.lon
mahal.value = lat.toFixed(2)+", "+lon.toFixed(2)
let wind = (3.6*data.wind.speed).toFixed(0)
let pres = (0.750062*data.main.pressure).toFixed(0)
const WIND = ['N','NE','E','SE','S','SW','W','NW','N']
let d = (data.wind.deg/45).toFixed(0)
detay.innerText = hh //+'\n'+yy +'\n['+mahal.value+"]"
+'\nWind '+wind+' km/h '+WIND[d]
+'\nPressure '+pres+' mm'
+'\nHumidity %'+data.main.humidity
let {sunrise, sunset} = sys, noon = (sunrise+sunset)/2
gunes.innerText = 'Rise '+toHM(sunrise+data.timezone)
+'\nNoon '+toHM(noon+data.timezone)
+'\nSet '+toHM(sunset+data.timezone)
+'\nZone '+(data.timezone/3600)
console.log(hh, yy, 'Wind '+data.wind.deg+'° '+WIND[d])
}