繁体   English   中英

从开放天气地图API返回的数据没有意义

[英]Data returned from open weather map API not making sense

我正在使用Open Weather Map API 我仍在玩电话。 我正在查看2个特定通话的结果。 一种是London ,另一种是South Africa Hermanus 我观察到的是,并非Hermanus调用返回的所有数据都在London调用返回的数据中。

这是我的两个电话:

返回伦敦的数据为:

{
     "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
}

返回给Hermanus的数据是:

{
     "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
}

为什么一个包含某些数据而另一个不包含某些数据? 我如何找出所有可以从此通话中返回的内容? 而且我怎么知道每个项目都意味着什么呢?

如果查看此页面,您将看到一些返回的键实际上是可选的:

http://openweathermap.org/wiki/API/2.0/Weather_Data

甚至明显的weather键也是可选的! :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM