我正在使用Open Weather Map API
。我仍然在打電話。我正在查看2個具體調用的結果。一個用於London
,另一個用於South Africa
的Hermanus
。我觀察到,並非Hermanus呼叫中返回的所有數據都在倫敦呼叫返回的數據中。從開放天氣圖API返回的數據沒有意義
這裏是我的2個呼叫:
- http://api.openweathermap.org/data/2.5/weather?q=london,uk
- http://api.openweathermap.org/data/2.5/weather?q=hermanus,za
倫敦返回的數據是:
{
"coord": {
"lon":-0.12574,
"lat":51.50853
},
"sys": {
"country":"GB",
"sunrise":1380261352,
"sunset":1380303998
},
"weather": [{
"id":800,
"main":"Clear",
"description":"Sky is Clear",
"icon":"01d"
}],
"base":"gdps stations",
"main": {
"temp":290.22,
"pressure":1016,
"humidity":63,
"temp_min":289.15,
"temp_max":291.48
},
"wind": {
"speed":6.2,
"deg":100
},
"clouds": {
"all":0
},
"dt":1380285272,
"id":2643743,
"name":"London",
"cod":200
}
而對於赫曼努斯返回的數據是:
{
"coord": {
"lon":19.234461,
"lat":-34.418701
},
"sys": {
"country":"ZA",
"sunrise":1380255856,
"sunset":1380300203
},
"weather": [{
"id":804,
"main":"Clouds",
"description":"overcast clouds",
"icon":"04d"
}],
"base":"gdps stations",
"main": {
"temp":284.981,
"temp_min":284.981,
"temp_max":284.981,
"pressure":999.07,
"sea_level":1026.12,
"grnd_level":999.07,
"humidity":77
},
"wind": {
"speed":6.71,
"deg":282
},
"rain": {
"3h":0
},
"clouds": {
"all":92
},
"dt":1380285425,
"id":3366880,
"name":"Hermanus",
"cod":200
}
爲什麼一個包含某些數據而另一個不是?我怎樣才能找出所有可以從這樣的電話返回?我怎麼知道每個項目意味着什麼是返回?
這完全取決於第三方返回什麼數據。他們可能沒有全部位置的全套數據。您可能最好從數據提供者本身請求信息。 –
羅裏是對的。我與他們的API有同樣的問題,有時不會返回rain.3h數據,有時它是0.也許是時候檢查另一個API像forecast.io – Jorre