"; echo "
"; echo "
"; $source = "https://api.openweathermap.org/data/2.5/weather?lat=$lat&lon=$lon&appid=5094d6e31255c4546a600f8a99db8bd3&units=metric&lang=hu"; $contents = file_get_contents($source); $clima = json_decode($contents,true); $lat = $clima['coord']['lat']; $lon = $clima['coord']['lon']; $id = $clima['weather'][0]['id']; $main = $clima['weather'][0]['main']; $description = $clima['weather'][0]['description']; $icon = $clima['weather'][0]['icon'].".png"; $temp = round($clima['main']['temp'], 0); $feels_like = round($clima['main']['feels_like'], 0); $pressure = $clima['main']['pressure']; $temphumidity = $clima['main']['humidity']; $humidity = $clima['main']['humidity']; $visibility = $clima['visibility']; $wind_speed = round($clima['wind']['speed']*3.6, 0); $wind_gust = $clima['wind']['gust'] ?? ""; $wind_deg = direction($clima['wind']['deg']); $clouds = $clima['clouds']; $rain_1h = $clima['rain']['1h'] ?? null; $snow_1h = $clima['snow']['1h'] ?? null; $sunrise = $clima['sys']['sunrise']; $sunset = $clima['sys']['sunset']; # $timezone = isset($clima->timezone); # $timezone_offset = isset($clima->timezone_offset); // current # $dt = $clima['current']['dt']; # $rain_1h = isset($clima['current']['rain']['1h']); # $snow_1h = isset($clima['current']['snow']['1h']); # $id = $clima['current']['weather'][0]['id']; # $main = $clima['current']['weather'][0]['main']; # $description = $clima['current']['weather'][0]['description']; $icon = $clima['weather'][0]['icon'].".png"; // alert $sender_name = $clima['alerts'][0]['sender_name'] ?? ""; $event = $clima['alerts'][0]['event'] ?? ""; $start = $clima['alerts'][0]['start'] ?? ""; $end = $clima['alerts'][0]['end'] ?? ""; $description = $clima['alerts'][0]['description'] ?? ""; $sender_name_2 = $clima['alerts'][1]['sender_name'] ?? ""; $event_2 = $clima['alerts'][1]['event'] ?? ""; $start_2 = $clima['alerts'][1]['start'] ?? ""; $end_2 = $clima['alerts'][1]['end'] ?? ""; $description_2 = $clima['alerts'][1]['description'] ?? ""; $sender_name_3 = $clima['alerts'][2]['sender_name'] ?? ""; $event_3 = $clima['alerts'][2]['event'] ?? ""; $start_3 = $clima['alerts'][2]['start'] ?? ""; $end_3 = $clima['alerts'][2]['end'] ?? ""; $description_3 = $clima['alerts'][2]['description'] ?? ""; $ah = round(13.2471*pow(exp(1),17.67*$temp/($temp+243.5))*$humidity/(273.15+$temp),1); echo "
"; echo "
".$description."

".$city."

"; echo "
"; echo "
"; echo "

" . $temp . " °C

"; echo " " . $feels_like . " °C hőérzet
"; echo " ".beaufort($wind_speed)."
"; echo " " . $wind_speed . " km/h " . $wind_deg ."i szél "; if ( $wind_gust != '' ) { echo round($wind_gust*3.6, 0) . "km/h-s lökésekkel"; } echo "
" . $pressure ." hPa légnyomás
"; echo " " . $humidity ."% páratartalom (" . $ah . " g/m3)
"; echo " napkelte: " . date("H:i", $sunrise) . ", napnyugta: " . date("H:i", $sunset); if (strpos($event, 'yellow') !== false) { $level = 'yellow';} elseif (strpos($event, 'orange') !== false) { $level = 'orange'; } elseif (strpos($event, 'red') !== false) { $level = 'red'; } if ( $event != "" ) { echo "

".translate(date("D H:i", $start))." - ".translate(date("D H:i", $end))."
".alerts($event)."

"; } if (strpos($event_2, 'yellow') !== false) { $level = 'yellow';} elseif (strpos($event_2, 'orange') !== false) { $level = 'orange'; } elseif (strpos($event_2, 'red') !== false) { $level = 'red'; } if ( $event_2 != "" ) { echo "

".translate(date("D H:i", $start_2))." - ".translate(date("D H:i", $end_2))."
".alerts($event_2)."

"; } if (strpos($event_3, 'yellow') !== false) { $level = 'yellow';} elseif (strpos($event_3, 'orange') !== false) { $level = 'orange'; } elseif (strpos($event_3, 'red') !== false) { $level = 'red'; } if ( $event_3 != "" ) { echo "

".translate(date("D H:i", $start_3))." - ".translate(date("D H:i", $end_3))."
".alerts($event_3)."

"; } echo "
"; # echo " Mai névnap: $mai_nev
"; echo "
"; if ( $rain_1h !== null ) { echo " ".$rain_1h." mm eső
"; } if ( $snow_1h !== null ) { echo " ".$snow_1h." mm hó
"; } # echo " " . $uvi ." UV index
"; # echo " " . $dew_point ."°C harmatpont
"; echo " " . $visibility ."m látótávolság
"; if ( $rain_1h !== null || $snow_1h !== null ) { $rainText = $rain_1h !== null ? $rain_1h." mm eső" : ""; $snowText = $snow_1h !== null ? $snow_1h." mm hó" : ""; echo "
Csapadék: ".trim($rainText." ".$snowText); } echo "
"; echo "
"; echo ""; echo "
"; echo "
"; echo "
"; ### End city card, map starts echo "
"; echo "
"; include 'terkep.php'; echo "
"; ### Map ends here, hour forecast starts ############################### $source = "https://api.openweathermap.org/data/2.5/forecast?lat=$lat&lon=$lon&appid=5094d6e31255c4546a600f8a99db8bd3&units=metric&lang=hu"; $contents = file_get_contents($source); $clima = json_decode($contents,true); echo "
"; echo "
"; echo "
"; echo "

Előrejelzés

"; foreach($clima['list'] as $forecast) { $temps[] = $forecast['main']['temp']; } $temp_max = max($temps); $temp_min = min($temps); $diff = ($temp_max-$temp_min)*8.5; echo "
"; foreach($clima['list'] as $forecast) { $dt = $forecast['dt']; $temp = $forecast['main']['temp']; $feels_like = $forecast['main']['feels_like']; # $temp_min = $forecast['main']['temp.min']; # $temp_max = $forecast['main']['temp.max']; $pressure = $forecast['main']['pressure']; $humidity = $forecast['main']['humidity']; # $dew_point = $forecast['main']['dew_point']; # $uvi = $forecast['main']['uvi']; $clouds = $forecast['clouds']; # $visibility = $forecast['visibility']; $visibility = $forecast['visibility'] ?? null; $wind_speed = $forecast['wind']['speed']; # $wind_gust = $forecast['wind_gust']; $wind_deg = $forecast['wind']['deg']; $pop = $forecast['pop']; $rain_1h = $forecast['rain']['1h'] ?? null; $snow_1h = $forecast['snow']['1h'] ?? null; $id = $forecast['weather'][0]['id']; $main = $forecast['weather'][0]['main']; $description = $forecast['weather'][0]['description']; $icon = $forecast['weather'][0]['icon']; $margin = ($temp_max*4.3)-$forecast['main']['temp']*4.7; if ( substr($forecast['weather'][0]['icon'], 2, 1) == 'd' ) { $class = "fok-max"; } else { $class = "fok-min"; } echo "
"; echo"
" . translate(date("M d", $dt)) . "
"; echo"
" . translate(date("l", $dt)) . "
"; echo "
" . translate(date("H", $dt)) . " óra
"; echo "
\""
" . round($temp, 0) . "°C
"; /* echo "
Sorry, your browser does not support inline SVG.
"; */ echo "
" . gCDshort($wind_deg) ."
"; echo "
" . round($wind_speed*3.6, 0) . "km/h
"; if ( $rain_1h !== null ) { echo "
" . $rain_1h . "mm
"; } if ( $snow_1h !== null ) { echo "
" . $snow_1h . "mm
"; } echo "
"; } echo "
"; echo "
"; echo "
"; ### 3 hours forecast ends, daily starts /* echo "
"; echo "
"; echo "
"; echo "

Napi előrejelzés

"; foreach($clima['daily'] as $day => $daily) { $temps_max[] = $daily['temp']['max']; $temps_min[] = $daily['temp']['min']; } $temp_max = max($temps_max); $temp_min = min($temps_min); $diff = ($temp_max-$temp_min)*11; echo "
"; foreach($clima['daily'] as $day => $daily) { $dt = $daily['dt']; $sunrise = $daily['sunrise']; $sunset = $daily['sunset']; $temp_morn = $daily['temp']['morn']; $temp_day = $daily['temp']['day']; $temp_eve = $daily['temp']['eve']; $temp_night = $daily['temp']['night']; $temp_d_min = $daily['temp']['min']; $temp_d_max = $daily['temp']['max']; $feels_morn = $daily['feels_like']['morn']; $feels_day = $daily['feels_like']['day']; $feels_eve = $daily['feels_like']['eve']; $feels_night = $daily['feels_like']['night']; $pressure = $daily['pressure']; $humidity = $daily['humidity']; $dew_point = $daily['dew_point']; $wind_speed = $daily['wind_speed']; $wind_gust = $daily['wind_gust']; $wind_deg = $daily['wind_deg']; $clouds = $daily['clouds']; $uvi = $daily['uvi']; $pop = $daily['pop']; $rain_1h = isset($daily['rain']['1h']); $snow_1h = isset($daily['snow']['1h']); $id = $daily['weather'][0]['id']; $main = $daily['weather'][0]['main']; $description = $daily['weather'][0]['description']; $icon = $daily['weather'][0]['icon']; $margin_max = ($temp_max*9.5)-round($temp_d_max,0)*9.5; $margin_min = ($temp_max*9.5)-round($temp_d_min,0)*9.5; echo "
" . translate(date("l", $dt)) . "
" . translate(date("M d", $dt)) . "
\""
" . round($temp_d_max, 0) . "°C
" . round($temp_d_min, 0) . "°C
"; /* echo "
Sorry, your browser does not support inline SVG.
"; *//* echo "
" . gCDshort($wind_deg) ."
"; echo "
" . round($wind_speed*3.6, 0) . "km/h
"; if ( $rain_1h != "" ) { echo "
" . $rain_1h . "mm
"; } if ( $snow_1h != "" ) { echo "
" . $snow_1h . "mm
"; } echo "
"; } echo "
"; echo "
"; echo "
"; */ echo "
"; echo "
"; echo "
"; echo "

Légszennyezettség

"; $source="http://api.openweathermap.org/data/2.5/air_pollution?lat=$lat&lon=$lon&appid=2c8baa7c8b0a66189de6199e3916cd3b"; $contents = file_get_contents($source); $clima=json_decode($contents); $aqi = $clima->list[0]->main->aqi; $co = $clima->list[0]->components->co; $no = $clima->list[0]->components->no; $no2 = $clima->list[0]->components->no2; $o3 = $clima->list[0]->components->o3; $so2 = $clima->list[0]->components->so2; $pm2_5 = $clima->list[0]->components->pm2_5; $pm10 = $clima->list[0]->components->pm10; $nh3 = $clima->list[0]->components->nh3; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Légszennyező anyag Koncentráció Küszöbérték
figyelmeztetés/riasztás
Levegőterheltségi szint ". $aqi . " (".aqi($aqi).")
Szén-monoxid CO ".$co." μg/m3 20000/30000
Nitrogén-monoxid NO ".$no." μg/m3
Nitrogén-dioxid NO2 ".$no2." μg/m3 350/400
Ózon O3 ".$o3." μg/m3 180/240
Kén-dioxid SO2 ".$so2." μg/m3 400/500
Szálló por PM2.5 ".$pm2_5." μg/m3
Szálló por PM10 ".$pm10." μg/m3 75/100
Ammónia NH3 ".$nh3." μg/m3
"; echo "
"; echo "
"; echo "
"; ?>
Az oldalon szereplő meteorológiai adatok forrása openweathermap.org, a stikk.hu kizárólag feldolgozza és megjeleníti a kapott adatokat, azok pontosságáért semmilyen felelősséget nem vállal.