使用openweather抓取氣候概況戰情室-node-red
使用openweather抓取氣候概況戰情室-node-red
openweather是作品研究時常拿來當做練習的API,這次想要做戰情室風格的Dashboard
開始之前先到openweather官網申請帳密,取得key
openweather-https://openweathermap.org/
key在圖中指引的地方可以看到
接著按上方列中的<API>--><Current Weather Data>-><API doc>
進去之後可以在這網頁裡找到要抓取的各種參數介紹和使用
Node-RED的部份分成4個部份
整個節點下載:氣候概況戰情室
1.從openweather API取得資料
#這裡不使用openweather節點,直接使用http請求節點取得data
這裡就是從上面1那裡最後取得的整個json裡截取出來的資料
每個地區的變化,是透過API的變數去回抓資料
例如:
http://api.openweathermap.org/geo/1.0/direct?q={{payload.area}}&appid=你的key
抓到地區的資訊後進而去抓地理位置
https://api.openweathermap.org/data/2.5/weather?lat={{lati}}&lon={{long}}&units=metric&appid=你的key











留言
張貼留言