1<!DOCTYPE html><html lang="en" dir="ltr"><head>
1<script>window.__WEATHERNOW_VISITOR_REGION__="US";</script>
1 2<!-- Google tag (gtag.js) -->
vendor: 64 bytes, lines 2-3
2 3<script async src="https://www.googletagmanager.com/gtag/js?id=
3G-FVHKPLT641
vendor: 12 bytes, line 3
3"></script>
4<script> 5
vendor: 131 bytes, lines 5-9
5window.dataLayer = window.dataLayer || []; 6 function gtag(){dataLayer.push(arguments);} 7 gtag('js', new Date()); 8 9 gtag('config', '
9G-FVHKPLT641
vendor: 4 bytes, line 9
9');
10</script>
10 11 12<meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/> 13<title>Beijing Weather Now: Live Radar, Hourly & 14-Day Forecast | Weather Now</title> 14<meta name="description" content="Beijing weather now with live radar, current conditions, hourly forecast, 14-day outlook, temperature, wind, humidity, pressure and storm tracking in China." /> 15<meta name="robots" content="index,follow"/><link rel="canonical" href="https://www.weathernow.app/weather/china/beijing/" /><meta name="theme-color" content="#0b1220"/> 16<style>:root{--bg:#0b1220;--bg2:#0a1322;--card:#0f1a30;--text:#e7eefc;--muted:#95a3c0} 17*{box-sizing:border-box}body{margin:0;color:var(--text);font-family:Inter,system-ui,Arial;background:linear-gradient(180deg,var(--bg),var(--bg2) 65%)} 18body.rtl{direction:rtl} 19.wrap{max-width:1200px;margin:0 auto;padding:24px 18px}a{color:#9fc0ff;text-decoration:none} 20header{position:sticky;top:0;background:rgba(8,12,22,.55);backdrop-filter:blur(10px);border-bottom:1px solid rgba(255,255,255,.08);z-index:10} 21header .row{display:flex;align-items:center;gap:16px;padding:16px 18px;max-width:1200px;margin:0 auto} 22header .brand{display:flex;gap:6px;align-items:baseline;color:#fff;text-decoration:none} 23header .brand .name{font-size:22px;font-weight:300}.now{font-size:24px;font-weight:900;background:linear-gradient(90deg,#4da3ff,#9f6bff);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent} 24h1{margin:18px 0 8px;font-size:clamp(26px,4vw,40px)}.lead{color:#c9d6f2;font-size:clamp(15px,2.2vw,18px);margin:0 0 14px} 25.card{background:var(--card);border:1px solid rgba(255,255,255,.08);border-radius:16px;box-shadow:0 10px 40px rgba(0,0,0,.35);overflow:hidden} 26.grid{display:grid;grid-template-columns:1.4fr .9fr;gap:16px}@media (max-width:960px){.grid{grid-template-columns:1fr}} 27.pane{padding:12px}#map{height:56vh;background:#0a1426} 28.legend{background:rgba(10,19,34,.9);color:#e7eefc;padding:10px 12px;border-radius:10px;border:1px solid rgba(255,255,255,.08);font-size:12px;line-height:1.2;box-shadow:0 6px 18px rgba(0,0,0,.35);min-width:180px} 29.legend h4{margin:0 0 8px;font-size:12px;color:#d9e6ff} 30.scale{height:10px;border-radius:6px;margin-bottom:4px;width:100%} 31.labels{display:flex;justify-content:space-between;color:#a9b8d6;font-size:11px;width:100%} 32.legend-row{margin-bottom:10px}.legend-row:last-child{margin-bottom:0} 33.wx-card{display:flex;flex-direction:column;gap:8px} 34.wx-hero{background:linear-gradient(135deg,rgba(15,28,55,.9),rgba(10,20,40,.72));border:1px solid rgba(77,163,255,.12);border-radius:14px;padding:12px 14px;display:flex;align-items:center;justify-content:space-between;gap:10px} 35.wx-temp{font-size:46px;font-weight:900;line-height:1;color:#fff;text-shadow:0 4px 16px rgba(77,163,255,.3);letter-spacing:0} 36.wx-desc{color:#c9d6f2;font-size:13px;margin-top:4px} 37.wx-feels{color:#7a9cc4;font-size:12px;margin-top:3px} 38.wx-icon{font-size:44px;line-height:1;filter:drop-shadow(0 4px 10px rgba(0,0,0,.4))} 39.wx-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px} 40.kv{display:flex;flex-direction:column;align-items:center;gap:4px;padding:9px 10px;border-radius:12px;background:rgba(12,20,37,.85);border:1px solid rgba(255,255,255,.06);min-height:64px} 41.kv-label{display:flex;align-items:center;gap:5px;color:#6b85aa;font-size:11px;text-transform:uppercase;letter-spacing:.04em;text-align:center} 42.kv-ico{width:13px;height:13px;display:inline-flex;flex-shrink:0}.kv-ico svg{width:100%;height:100%} 43.kv-val{color:#e7eefc;font-size:16px;font-weight:800;letter-spacing:0;text-align:center} 44.rain-meta{color:#9fb1d1;font-size:12px;line-height:1.35;background:rgba(12,20,37,.65);border:1px solid rgba(255,255,255,.06);border-radius:12px;padding:9px 10px} 45.updated{color:#7185aa;font-size:12px} 46.loc-marker{position:relative;width:32px;height:32px} 47.loc-dot{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:16px;height:16px;border-radius:50%;background:#ff4d4d;border:2.5px solid #fff;box-shadow:0 0 0 3px #c0392b,0 2px 10px rgba(0,0,0,.6);z-index:2} 48.loc-pulse{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:32px;height:32px;border-radius:50%;background:rgba(255,77,77,.3);animation:loc-ripple 2s ease-out infinite;z-index:1} 49@keyframes loc-ripple{0%{transform:translate(-50%,-50%) scale(.4);opacity:.9}100%{transform:translate(-50%,-50%) scale(2.2);opacity:0}
49} 50.faq{margin-top:16px}.crumbs{font-size:14px;color:#c9d6f2;margin:10px 0 0} 51footer{border-top:1px solid rgba(255,255,255,.08);margin-top:24px}footer .row{max-width:1200px;margin:0 auto;padding:24px 18px;color:rgba(169,184,214,.70);display:flex;justify-content:space-between;flex-wrap:wrap;gap:10px} 52.btn{display:inline-flex;align-items:center;gap:8px;padding:10px 14px;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:linear-gradient(180deg,#1c2a45,#17233b);color:#fff} 53.pillbar{position:sticky;top:0;z-index:20;display:inline-flex;gap:8px;background:rgba(12,20,37,.92);padding:8px;border-radius:16px;border:1px solid rgba(255,255,255,.12);backdrop-filter:blur(6px);margin:10px} 54.pill{font-size:14px;font-weight:700;letter-spacing:.02em;padding:8px 14px;border-radius:999px;border:1px solid rgba(255,255,255,.18);color:#e7eefc;background:#0f1a30;cursor:pointer} 55.pill.active{background:#21406b;color:#fff;box-shadow:0 0 0 2px rgba(77,163,255,.25) inset,0 0 14px rgba(77,163,255,.25)} 56.toolbar{display:flex;gap:8px;align-items:center;justify-content:flex-end;margin:8px 0} 57.toggle{padding:6px 10px;border-radius:10px;border:1px solid rgba(255,255,255,.18);background:#0f1a30;color:#fff;cursor:pointer;font-size:14px} 58</style>
58<script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is the weather in Beijing now?","acceptedAnswer":{"@type":"Answer","text":"Weather Now shows Beijing weather now with current temperature, live rain radar, wind, humidity, pressure and precipitation updates."}},{"@type":"Question","name":"Can I see Beijing weather radar live?","acceptedAnswer":{"@type":"Answer","text":"Yes. The Beijing page includes live rain radar and cloud movement so you can track showers and storms around Beijing."}},{"@type":"Question","name":"Does Weather Now show the Beijing hourly forecast?","acceptedAnswer":{"@type":"Answer","text":"Yes. Use Weather Now to compare Beijing hourly weather, rain chances, wind changes and the 14-day outlook."}}]}</script>
58 59 60 <link rel="alternate" hreflang="en" href="https://www.weathernow.app/weather/china/beijing/" /> 61 <link rel="alternate" hreflang="x-default" href="https://www.weathernow.app/weather/china/beijing/" /> 62 <link rel="alternate" hreflang="ar" href="https://www.weathernow.app/ar/weather/china/beijing/" /> 63 <link rel="alternate" hreflang="de" href="https://www.weathernow.app/de/weather/china/beijing/" /> 64 <link rel="alternate" hreflang="es" href="https://www.weathernow.app/es/weather/china/beijing/" /> 65 <link rel="alternate" hreflang="fr" href="https://www.weathernow.app/fr/weather/china/beijing/" /> 66 <link rel="alternate" hreflang="hi" href="https://www.weathernow.app/hi/weather/china/beijing/" /> 67 <link rel="alternate" hreflang="it" href="https://www.weathernow.app/it/weather/china/beijing/" /> 68 <link rel="alternate" hreflang="ja" href="https://www.weathernow.app/ja/weather/china/beijing/" /> 69 <link rel="alternate" hreflang="ko" href="https://www.weathernow.app/ko/weather/china/beijing/" /> 70 <link rel="alternate" hreflang="pl" href="https://www.weathernow.app/pl/weather/china/beijing/" /> 71 <link rel="alternate" hreflang="pt" href="https://www.weathernow.app/pt/weather/china/beijing/" /> 72 <link rel="alternate" hreflang="zh" href="https://www.weathernow.app/zh/weather/china/beijing/" /> 73 74 75 <meta property="og:type" content="website" /> 76 <meta property="og:site_name" content="Weather Now" /> 77 <meta property="og:locale" content="en_US" /> 78 <meta property="og:title" content="Beijing Weather Now: Live Radar & Hourly Forecast" /> 79 <meta property="og:description" content="Track Beijing weather now: live rain radar, current conditions, hourly forecast and 14-day outlook for China." /> 80 <meta property="og:url" content="https://www.weathernow.app/weather/china/beijing/" /> 81 <meta property="og:image" content="https://www.weathernow.app/images/og/city/china-beijing.jpg" /> 82 83 <meta name="twitter:card" content="summary_large_image" /> 84 <meta name="twitter:title" content="Beijing weather now and live radar" /> 85 <meta name="twitter:description" content="Track Beijing weather now: live rain radar, current conditions, hourly forecast and 14-day outlook for China." /> 86 <meta name="twitter:image" content="https://www.weathernow.app/images/og/city/china-beijing.jpg" /> 87
88<script type="application/ld+json">{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{"@type": "ListItem", "position": 1, "name": "Weather Now", "item": "https://www.weathernow.app/"}, {"@type": "ListItem", "position": 2, "name": "Weather in China", "item": "https://www.weathernow.app/weather/china/"}, {"@type": "ListItem", "position": 3, "name": "Weather in Beijing", "item": "https://www.weathernow.app/weather/china/beijing/"}]}</script>
88 89<!-- seo-enhanced-v2 -->
90<script type="application/ld+json" data-seo="place">{"@context":"https://schema.org","@type":"Place","name":"Beijing, China","url":"https://www.weathernow.app/weather/china/beijing/","geo":{"@type":"GeoCoordinates","latitude":39.9042,"longitude":116.4074}}</script>
90 91<link rel="stylesheet" href="/css/site-v2.css?v=20260720-16">
91<script src="/js/site-v2-shell.js?v=20260719-5" defer></script>
91<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css"><link rel="stylesheet" href="/css/home-v2-preview.css?v=279"><link rel="stylesheet" href="/css/city-weather-v2.css?v=20260720-15">
91<script src="/js/temperature-units.js?v=5" defer></script>
91<script src="/js/map-day-night.js?v=1" defer></script>
91<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" defer></script>
91<script src="/js/city-weather-v2.js?v=20260720-14" defer></script>
91<link rel="alternate" type="application/json" data-weather-json href="https://www.weathernow.app/api/weather/current?latitude=39.9042&longitude=116.4074" title="Machine-readable current weather for Beijing">
92<script type="application/ld+json" data-seo="en-gsc-ctr-webpage">{"@context":"https://schema.org","@type":"WebPage","@id":"https://www.weathernow.app/weather/china/beijing/#gsc-ctr","url":"https://www.weathernow.app/weather/china/beijing/","name":"Beijing Weather Now: Live Radar, Hourly & 14-Day Forecast | Weather Now","description":"Beijing weather now with live radar, current conditions, hourly forecast, 14-day outlook, temperature, wind, humidity, pressure and storm tracking in China.","inLanguage":"en","isPartOf":{"@type":"WebSite","name":"Weather Now","url":"https://www.weathernow.app/"},"about":[{"@type":"Place","name":"Beijing, China"},{"@type":"Thing","name":"Beijing"},{"@type":"Thing","name":"Beijing weather now"},{"@type":"Thing","name":"Beijing weather radar"},{"@type":"Thing","name":"weather now"},{"@type":"Thing","name":"live weather radar"},{"@type":"Thing","name":"hourly forecast"}],"keywords":"Beijing weather now, Beijing weather radar, weather now, live weather radar, hourly forecast"}</script>
92 93<style id="wn-site-navigation"> 94.wn-site-header{position:fixed!important;inset:0 0 auto!important;z-index:2147483000!important;width:100%!important;height:92px!important;box-sizing:border-box!important;direction:ltr!important;border:0!important;background:transparent!important;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif!important} 95.wn-header-inner{width:calc(100% - 24px)!important;max-width:1480px!important;height:64px!important;margin:14px auto 0!important;padding:0 24px!important;display:flex!important;align-items:center!important;gap:24px!important;box-sizing:border-box!important;border:1px solid rgba(220,237,248,.13)!important;border-radius:999px!important;background:rgba(8,12,15,.62)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.065),0 2px 6px rgba(0,0,0,.14),0 9px 24px rgba(0,0,0,.18)!important;backdrop-filter:blur(28px) saturate(145%)!important;-webkit-backdrop-filter:blur(28px) saturate(145%)!important} 96.wn-brand{--wordmark-size:26px;display:inline-flex!important;align-items:center!important;color:#fff!important;text-decoration:none!important;white-space:nowrap!important} 97.wn-brand-wordmark{display:block!important;width:calc(var(--wordmark-size) * 7.52)!important;height:calc(var(--wordmark-size) * 1.0405)!important;overflow:visible!important} 98.wn-brand-name,.wn-brand-now{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif!important;font-size:88px!important;line-height:1!important;dominant-baseline:alphabetic!important;letter-spacing:0!important}.wn-brand-name{fill:url(#wnEdgeLogoName)!important;font-weight:600!important}.wn-brand-now{fill:url(#wnEdgeLogoNow)!important;font-weight:900!important} 99.wn-site-nav{margin-left:auto!important;display:flex!important;align-items:center!important;gap:clamp(18px,2.5vw,38px)!important;white-space:nowrap!important} 100.wn-site-nav a{display:inline-flex!important;align-items:center!important;color:#b5c1ca!important;font-size:14px!important;font-weight:600!important;line-height:26px!important;letter-spacing:.08em!important;text-transform:uppercase!important;text-decoration:none!important} 101.wn-site-nav a:hover,.wn-site-nav a[aria-current="page"]{color:#fff!important} 102@media(max-width:720px){.wn-site-header{height:74px!important}.wn-header-inner{width:calc(100% - 20px)!important;height:56px!important;margin-top:9px!important;padding:0 14px!important;gap:10px!important}.wn-brand{--wordmark-size:20px}.wn-site-nav{gap:11px!important}.wn-site-nav a{font-size:14px!important}.wn-site-nav a[href$="/weather/"],.wn-site-nav a[href="/guides/"]{display:none!important}.searchbar{top:74px!important}} 103@media(max-width:390px){.wn-header-inner{padding:0 10px!important}.wn-site-nav{gap:9px!important}.wn-site-nav a{font-size:13px!important;letter-spacing:.03em!important}} 104</style></head><body class=" wn-v2-page"><header class="wn-site-header"><div class="wn-header-inner"><a class="wn-brand" href="/" aria-label="Weather Now home"><svg class="wn-brand-wordmark" viewBox="0 0 636 88" role="img" aria-label="Weather NOW" focusable="false"><defs><linearGradient id="wnEdgeLogoName" x1="0%" y1="50%" x2="100%" y2="50%"><stop offset="0%" stop-color="#fff"/><stop offset="66.35677083%" stop-color="#fff"/><stop offset="97.421875%" stop-color="#606060"/><stop offset="100%" stop-color="#606060"/></linearGradient><linearGradient id="wnEdgeLogoNow" x1="0%" y1="50%" x2="100%" y2="50%"><stop offset="0%" stop-color="#5ba9ff"/><stop offset="100%" stop-color="#a56cff"/></linearGradient></defs><text class="wn-brand-name" x="0" y="72">WEATHER</text><text class="wn-brand-now" x="412" y="72">NOW</text></svg></a><nav class="wn-site-nav" aria-label="Primary navigation"><a href="/weather/" aria-current="page">Weather</a><a href="/guides/">Guides</a><a href="/support">Support</a><a href="/?download=1#download-app">Download</a></nav></div></header> 105 106<div class="wrap"><nav class="crumbs" aria-label="breadcrumb"><a href="/">Weather Now</a> ⺠<a href="/weather/china/">Weather in China</a> ⺠<strong>Weather in Beijing</strong></nav> 107<h1>Beijing Weather Now</h1><p class="lead">Live rain radar, current conditions and hourly forecast for Beijing, China.</p> 108<noscript><p>Live weather data requires JavaScript. Beijing weather: temperature, precipitation, wind speed, humidity and atmospheric pressure â updated hourly via Weather Now. Use the radar map to track rain and storms in real time.</p></noscript> 109<div class="grid"><div class="card"><div id="map"></div></div> 110<aside class="card pane wx-card" id="wx" aria-label="Live weather conditions"><div class="wx-hero"><div><div class="wx-temp" id="t_now">â</div><div class="wx-desc" id="wx_summary">Live conditions</div><div class="wx-feels"><span>Feels like</span> <strong id="t_feels">â</strong></div></div><div class="wx-icon" id="wx_icon" aria-hidden="true">ð¡ï¸</div></div> 111<div class="wx-grid"> 112<div class="kv"><div class="kv-label"><i class="kv-ico" data-icon="precip"></i>Precipitation</div><div class="kv-val" id="precip_now">â</div></div> 113<div class="kv"><div class="kv-label"><i class="kv-ico" data-icon="wind"></i>Wind</div><div class="kv-val" id="wind_now">â</div></div> 114<div class="kv"><div class="kv-label"><i class="kv-ico" data-icon="humidity"></i>Humidity</div><div class="kv-val" id="rh_now">â</div></div> 115<div class="kv"><div class="kv-label"><i class="kv-ico" data-icon="pressure"></i>
115Pressure</div><div class="kv-val" id="pressure_now">â</div></div> 116</div><div class="rain-meta" id="rain_meta">Rain radar loadingâ¦</div><div class="updated" id="updated">Loadingâ¦</div></aside></div> 117<div class="seo-static" style="margin:12px 0 16px"> 118 <p style="color:#c9d6f2;font-size:15px;margin:0 0 8px">Weather Now shows real-time conditions and a 24-hour forecast for Beijing, China. The interactive radar map lets you track rain and storms live, with layers for precipitation, cloud cover and temperature.</p> 119 <p style="color:#c9d6f2;font-size:14px;margin:0 0 8px">Current data includes temperature, feels-like, wind speed, humidity, pressure and precipitation â updated every hour from open-meteo. Download the free app for hourly widgets and severe weather alerts.</p> 120 <!-- seo-enhanced-v4 --> 121 <section class="seo-city-details" aria-label="Local weather guide" style="margin-top:12px;color:#c9d6f2;font-size:14px;line-height:1.55"> 122 <h2 style="font-size:20px;color:#e7eefc;margin:0 0 8px">Beijing weather details</h2> 123 <p style="margin:0 0 8px">Check live weather in Beijing, China with a practical forecast summary for the next day. The radar layer helps follow rain cells and storm movement, while the forecast panel highlights temperature, feels-like temperature, humidity, pressure, precipitation and wind.</p> 124 <p style="margin:0 0 8px">For local planning in China, compare the rain trend with cloud cover, sunrise and sunset timing, UV index, air quality, wind speed and seasonal climate patterns around Beijing. These signals help explain whether conditions are improving, staying stable or turning unsettled.</p> 125 <ul style="margin:0 0 0 18px;padding:0"> 126 <li>Track precipitation and cloud movement on the live radar map.</li> 127 <li>Use UV, sunrise, sunset and air quality context before outdoor plans.</li> 128 <li>Compare pressure, humidity and wind trends with the local seasonal climate.</li> 129 </ul> 130 </section> 131</div> 132 133<!-- en-gsc-ctr-copy --> 134<div class="gsc-ctr-copy" style="margin:0 0 12px;color:#c9d6f2;font-size:15px;line-height:1.6"> 135 <p style="margin:0 0 8px">Beijing weather now focuses on live radar, current temperature, rain trend, wind, humidity and pressure for quick local planning.</p> 136 <p style="margin:0 0 8px">Use the hourly forecast and 14-day outlook to compare rain, cloud cover, UV, air quality and storm risk before travel or outdoor plans in Beijing.</p> 137</div> 138<!-- /en-gsc-ctr-copy --> 139<section class="faq"><h2>FAQ about weather in Beijing</h2><ul> 140<li><strong>Is it raining now?</strong> <span id="faq_rain">â</span></li> 141<li><strong>When is the next rain peak?</strong> <span id="faq_rain_peak">â</span></li> 142<li><strong>Day vs night temperatures?</strong> <span id="faq_temp">â</span></li></ul></section></div> 143<footer><div class="row"><div>© 2002â2026 Weather NOW</div><div><a href="/term-of-use">Terms</a> · <a href="/privacy">Privacy</a></div></div></footer> 144<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
144<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
vendor: 1 bytes, line 144
144
145<script>(function(){ 146 const LAT=39.9042,LON=116.4074; 147 148 const map=L.map('map',{zoomControl:true,scrollWheelZoom:false,attributionControl:false}).setView([LAT,LON],5); 149 L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png',{maxZoom:19,attribution:'',zIndex:1,noWrap:true}).addTo(map); 150 151 let rainLayer=null; 152 async function loadRain(){ 153 let latest=Math.floor(Date.now()/600000)*600-600; 154 let tilePath=`/v2/radar/${latest}`; 155 try{ 156 const data=await getJSON('https://api.rainviewer.com/public/weather-maps.json'); 157 const last=(data&&data.radar&&data.radar.past?data.radar.past:[]).slice(-1)[0]; 158 if(last) tilePath=last.path||`/v2/radar/${last.time}`; 159 }catch(e){console.warn(e);} 160 if(rainLayer) map.removeLayer(rainLayer); 161 rainLayer=L.tileLayer(`https://tilecache.rainviewer.com${tilePath}/256/{z}/{x}/{y}/2/1_1.png`,{opacity:0.85,zIndex:6,noWrap:true,maxNativeZoom:6}); 162 rainLayer.addTo(map); 163 } 164 loadRain(); setInterval(loadRain,5*60*1000); 165 const mapLegend = L.control({ position: 'bottomleft' }); 166 mapLegend.onAdd = function() { 167 const div = L.DomUtil.create('div', 'legend'); 168 div.innerHTML = ` 169 <h4>Precipitation</h4> 170 <div class="legend-row"> 171 <div class="scale" style="background:linear-gradient(to right,#b0e8ff,#00c8ff,#00c800,#c8c800,#ff8000,#ff0000,#800000)"></div> 172 <div class="labels"><span>Light</span><span>Moderate</span><span>Heavy</span></div> 173 </div>`; 174 return div; 175 }; 176 mapLegend.addTo(map); 177 const markerIcon=L.divIcon({className:'',html:'<div class="loc-marker"><div class="loc-pulse"></div><div class="loc-dot"></div></div>',iconSize:[32,32],iconAnchor:[16,16],popupAnchor:[0,-16]}); 178 const marker=L.marker([LAT,LON],{icon:markerIcon}).addTo(map).bindPopup("ð¨ð³ Beijing, China").openPopup(); 179 180 let UNIT = localStorage.getItem('wn_unit') || 'C'; // 'C' or 'F' 181 const unitLbl = document.getElementById('unit_lbl'); 182 function toF(c){ return (c*9/5)+32; } 183 function fmtTemp(c){ if(c==null || c==='â') return 'â'; return (UNIT==='C'? c : toF(c)).toFixed(1) + '°' + UNIT; } 184 function fmtWind(ms){ if(ms==null) return 'â'; return ms.toFixed(1)+' m/s'; } 185 function fmt(val,suffix){ if(val==null) return 'â'; return val+' '+suffix; } 186 function fmtRain(val){ if(val==null) return 'â'; return Number(val).toFixed(1)+' mm/h'; } 187 function fmtPressure(val){ if(val==null) return 'â'; return Math.round(Number(val))+' hPa'; } 188 function codeToText(w){ 189 if(w==null) return 'Current weather'; 190 if(w===0) return 'Clear sky'; 191 if([1,2,3].includes(w)) return 'Partly cloudy'; 192 if([45,48].includes(w)) return 'Fog'; 193 if([51,53,55,56,57].includes(w)) return 'Drizzle'; 194 if([61,63,65,66,67,80,81,82].includes(w)) return 'Rain'; 195 if([71,73,75,77,85,86].includes(w)) return 'Snow'; 196 if([95,96,99].includes(w)) return 'Thunderstorm'; 197 return 'Current weather'; 198 } 199 function codeToEmoji(w){ 200 if(w==null) return 'ð¡ï¸'; 201 if(w===0) return 'âï¸'; 202 if([1,2,3].includes(w)) return 'â '; 203 if([45,48].includes(w)) return 'ð«ï¸'; 204 if([51,53,55,56,57].includes(w)) return 'ð¦ï¸'; 205 if([61,63,65,66,67,80,81,82].includes(w)) return 'ð§ï¸'; 206 if([71,73,75,77,85,86].includes(w)) return 'âï¸'; 207 if([95,96,99].includes(w)) return 'âï¸'; 208 return 'ð¡ï¸'; 209 } 210 211 function fmtRain(val){ if(val==null) return 'â'; return Number(val).toFixed(1)+' mm/h'; } 212 function fmtPressure(val){ if(val==null) return 'â'; return Math.round(Number(val))+' hPa'; } 213 function codeToText(w){ 214 if(w==null) return 'Current weather'; 215 if(w===0) return 'Clear sky'; 216 if([1,2,3].includes(w)) return 'Partly cloudy'; 217 if([45,48].includes(w)) return 'Fog'; 218 if([51,53,55,56,57].includes(w)) return 'Drizzle'; 219 if([61,63,65,66,67,80,81,82].includes(w)) return 'Rain'; 220 if([71,73,75,77,85,86].includes(w)) return 'Snow'; 221 if([95,96,99].includes(w)) return 'Thunderstorm'; 222 return 'Current weather'; 223 } 224 function codeToEmoji(w){ 225 if(w==null) return 'ð¡ï¸'; 226 if(w===0) return 'âï¸'; 227 if([1,2,3].includes(w)) return 'â '; 228 if([45,48].includes(w)) return 'ð«ï¸'; 229 if([51,53,55,56,57].includes(w)) return 'ð¦ï¸'; 230 if([61,63,65,66,67,80,81,82].includes(w)) return 'ð§ï¸'; 231 if([71,73,75,77,85,86].includes(w)) return 'âï¸'; 232 if([95,96,99].includes(w)) return 'âï¸'; 233 return 'ð¡ï¸'; 234 } 235 236 function fmtRain(val){ if(val==null) return 'â'; return Number(val).toFixed(1)+' mm/h'; } 237 function fmtPressure(val){ if(val==null) return 'â'; return Math.round(Number(val))+' hPa'; } 238 function codeToText(w){ 239 if(w==null) return 'Current weather'; 240 if(w===0) return 'Clear sky'; 241 if([1,2,3].includes(w)) return 'Partly cloudy'; 242 if([45,48].includes(w)) return 'Fog'; 243 if([51,53,55,56,57].includes(w)) return 'Drizzle';
244 if([61,63,65,66,67,80,81,82].includes(w)) return 'Rain'; 245 if([71,73,75,77,85,86].includes(w)) return 'Snow'; 246 if([95,96,99].includes(w)) return 'Thunderstorm'; 247 return 'Current weather'; 248 } 249 function codeToEmoji(w){ 250 if(w==null) return 'ð¡ï¸'; 251 if(w===0) return 'âï¸'; 252 if([1,2,3].includes(w)) return 'â '; 253 if([45,48].includes(w)) return 'ð«ï¸'; 254 if([51,53,55,56,57].includes(w)) return 'ð¦ï¸'; 255 if([61,63,65,66,67,80,81,82].includes(w)) return 'ð§ï¸'; 256 if([71,73,75,77,85,86].includes(w)) return 'âï¸'; 257 if([95,96,99].includes(w)) return 'âï¸'; 258 return 'ð¡ï¸'; 259 } 260 261 function fmtRain(val){ if(val==null) return 'â'; return Number(val).toFixed(1)+' mm/h'; } 262 function fmtPressure(val){ if(val==null) return 'â'; return Math.round(Number(val))+' hPa'; } 263 function codeToText(w){ 264 if(w==null) return 'Current weather'; 265 if(w===0) return 'Clear sky'; 266 if([1,2,3].includes(w)) return 'Partly cloudy'; 267 if([45,48].includes(w)) return 'Fog'; 268 if([51,53,55,56,57].includes(w)) return 'Drizzle'; 269 if([61,63,65,66,67,80,81,82].includes(w)) return 'Rain'; 270 if([71,73,75,77,85,86].includes(w)) return 'Snow'; 271 if([95,96,99].includes(w)) return 'Thunderstorm'; 272 return 'Current weather'; 273 } 274 function codeToEmoji(w){ 275 if(w==null) return 'ð¡ï¸'; 276 if(w===0) return 'âï¸'; 277 if([1,2,3].includes(w)) return 'â '; 278 if([45,48].includes(w)) return 'ð«ï¸'; 279 if([51,53,55,56,57].includes(w)) return 'ð¦ï¸'; 280 if([61,63,65,66,67,80,81,82].includes(w)) return 'ð§ï¸'; 281 if([71,73,75,77,85,86].includes(w)) return 'âï¸'; 282 if([95,96,99].includes(w)) return 'âï¸'; 283 return 'ð¡ï¸'; 284 } 285 286 287 const unitBtn = document.getElementById('unitBtn'); 288 if(unitBtn) unitBtn.addEventListener('click', ()=>{ UNIT = (UNIT==='C'?'F':'C'); localStorage.setItem('wn_unit', UNIT); if(unitLbl) unitLbl.textContent = '°'+UNIT; if(window._cur) renderData(window._cur, window._hourly, window._meta); }); 289 290 function getJSON(url){ 291 if(typeof fetch==='function') return fetch(url).then(r=>r.json()); 292 return new Promise((resolve,reject)=>{ 293 const xhr=new XMLHttpRequest(); 294 xhr.open('GET',url,true); 295 xhr.onload=()=>{ try{ resolve(JSON.parse(xhr.responseText)); }catch(e){ reject(e); } }; 296 xhr.onerror=reject; 297 xhr.send(); 298 }); 299 } 300 301 function estimatedWeather(){ 302 const now=new Date(); 303 const month=now.getMonth(); 304 const seasonal=Math.cos((month-6)/6*Math.PI); 305 const latFactor=Math.max(-18,Math.min(18,(45-Math.abs(LAT))*0.35)); 306 const temp=Math.round((14+10*seasonal+latFactor)*10)/10; 307 const precip=Math.max(0,Math.round((((Math.abs(LAT)+Math.abs(LON))%4)-1.8)*10)/10); 308 const wind=Math.round((2.5+((Math.abs(LON)+month)%6))*10)/10; 309 const humidity=Math.round(52+((Math.abs(LAT)+month*7)%35)); 310 const pressure=Math.round((1011+((Math.abs(LON)-Math.abs(LAT))%12))*10)/10; 311 const iso=now.toISOString().slice(0,16); 312 return { 313 timezone_abbreviation:'local preview', 314 current:{ 315 time:iso, 316 temperature_2m:temp, 317 apparent_temperature:Math.round((temp-(wind>6?1.8:0.6))*10)/10, 318 precipitation:precip, 319 wind_speed_10m:wind, 320 relative_humidity_2m:humidity, 321 pressure_msl:pressure 322 }, 323 hourly:{ 324 time:Array.from({length:24},(_,i)=>new Date(now.getTime()+i*3600000).toISOString().slice(0,16)), 325 temperature_2m:Array.from({length:24},(_,i)=>Math.round((temp+Math.sin(i/24*Math.PI*2)*3)*10)/10), 326 precipitation:Array.from({length:24},(_,i)=>i%7===0?precip:0) 327 } 328 }; 329 } 330 331 async function loadWeather(){ 332 try{ 333 const url=`https://api.open-meteo.com/v1/forecast?latitude=${LAT}&longitude=${LON}¤t=temperature_2m,apparent_temperature,precipitation,weather_code,wind_speed_10m,relative_humidity_2m,pressure_msl&hourly=temperature_2m,precipitation&timezone=auto`; 334 let d; try{ d=await getJSON(url); }catch(e){ console.warn(e); d=estimatedWeather(); } 335 if(document.body.classList.contains('city-weather-home-dashboard'))return; 336 window._cur=d.current||{}; window._hourly=d.hourly||{}; window._meta=d; 337 if(unitLbl) unitLbl.textContent='°'+UNIT; 338 renderData(window._cur, window._hourly, window._meta); 339 }catch(e){ document.getElementById('updated').textContent='Weather data failed to load.'; console.warn(e); } 340 } 341 342 function renderData(cur, hourly, meta){ 343 const iconMap={ 344 precip:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M12 3c3 4 6 7.5 6 10.2A6 6 0 0 1 6 13.2C6 10.5 9 7 12 3z"/></svg>', 345 wind:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" xmlns="http://www.w3.org/2000/svg"><path d="M3 8h10.5a2.5 2.5 0 1 0-2.5-2.5"/><path d="M3 12h14.5a2.5 2.5 0 1 1-2.5 2.5"/><path d="M3 16h7.5a2 2 0 1 1-2 2"/></svg>', 346 humidity:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M12 2c3.5 5 7 8.5 7 12a7 7 0 1 1-14 0c0-3.5 3.5-7 7-12z"/></svg>', 347 pressure:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M12 4a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12zm0 1.5a.75.75 0 0 1 .75.75V12l3 3-.75.75L11.25 12V8.25A.75.75 0 0 1 12 7.5z"/></svg>' 348 }; 349 document.querySelectorAll('.kv-ico[data-icon]').forEach(el=>{ el.innerHTML=iconMap[el.dataset.icon]||''; }); 350 document.getElementById('t_now').textContent=fmtTemp(cur.temperature_2m); 351 document.getElementById('t_feels').textContent=fmtTemp(cur.apparent_temperature); 352 document.getElementById('wx_summary').textContent=codeToText(cur.weather_code); 353 document.getElementById('wx_icon').textContent=codeToEmoji(cur.weather_code); 354 document.getElementById('precip_now').textContent=fmtRain(cur.precipitation); 355 document.getElementById('wind_now').textContent=fmtWind(cur.wind_speed_10m||0); 356 document.getElementById('rh_now').textContent=fmt(cur.relative_humidity_2m,'%'); 357 document.getElementById('pressure_now').textContent=fmtPressure(cur.pressure_msl); 358 document.getElementById('updated').textContent='Updated: '+(meta.timezone_abbreviation||'')+' '+(cur.time||''); 359 const rainNow=(cur.precipitation||0)>0?'Yes':'No'; 360 document.getElementById('faq_rain').textContent=rainNow+(cur.precipitation?` (${Number(cur.precipitation).toFixed(1)} mm/h)`:''); 361 362 let nextPeak='â'; 363 let maxVal=0,maxTime=null; 364 if(hourly.time && hourly.precipitation){ 365 const nowMs=cur.time ? Date.parse(cur.time) : Date.now(); 366 let idx=hourly.time.findIndex(t=>Date.parse(t)>=nowMs); 367 if(idx<0) idx=Math.max(0,hourly.time.length-24); 368 const end=Math.min(hourly.time.length,idx+24); 369 for(let i=idx;i<end;i++){ const val=hourly.precipitation[i]||0; if(val>maxVal){maxVal=val;maxTime=hourly.time[i];} } 370 if(maxTime && maxVal>0) nextPeak=`${maxTime} (${Number(maxVal).toFixed(1)} mm/h)`; 371 } 372 document.getElementById('faq_rain_peak').textContent=nextPeak; 373 const rainMeta=document.getElementById('rain_meta'); 374 if(rainMeta) rainMeta.textContent=maxVal>0 ? `Next rain peak: ${Number(maxVal).toFixed(1)} mm/h at ${maxTime}. Radar layer is active.` : `No measurable rain in the next 24 hours. Radar layer is active.`; 375 376 let tMax=null,tMin=null; 377 if(hourly.temperature_2m && hourly.time){ 378 const nowMs=cur.time ? Date.parse(cur.time) : Date.now(); 379 let idx=hourly.time.findIndex(t=>Date.parse(t)>=nowMs); 380 if(idx<0) idx=Math.max(0,hourly.time.length-24); 381 const end=Math.min(hourly.time.length,idx+24); 382 for(let i=idx;i<end;i++){ 383 const v=hourly.temperature_2m[i]; 384 if(typeof v==='number'){ if(tMax===null||v>tMax) tMax=v; if(tMin===null||v<tMin) tMin=v; } 385 } 386 } 387 document.getElementById('faq_temp').textContent=(tMax!==null&&tMin!==null)?`Day ~ ${Math.round(UNIT==='C'?tMax:toF(tMax))}°${UNIT}, Night ~ ${Math.round(UNIT==='C'?tMin:toF(tMin))}°${UNIT}`:'â'; 388 } 389 390 loadWeather(); 391})();</script>
vendor: 1 bytes, line 391
391
392<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"1ff7f7f9aff34e318df6054150200e7d","r":1,"spa":2}' crossorigin="anonymous"></script>
392 393</body></html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.