简体   繁体   中英

Data returned from open weather map API not making sense

I am using the Open Weather Map API . I am still playing around with the calls. I am having a look at the results of 2 specific calls. One is for London and the other is for Hermanus in South Africa . What I observed it that not all data returned in the Hermanus call is in the data returned from the London call.

Here are my 2 calls:

The data returned for London is:

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

And the data returned for Hermanus is:

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

Why does the one contain certain data and the other not? How can I find out what all can be returned from such a call? And how do I know what each item means that is returned?

If you take a look at this page, you will see that some returned keys are actually optional:

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

Even the obvious weather key is optional! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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