当前位置: 动力学知识库 > 问答 > 编程问答 >

android - How to disambiguate the JSON weather forecast provided by the Open Weather Map API?

问题描述:

Unlike Yahoo Weather API, the weather forecast response from Open Weather (JSON in particular) contains no details about Day and Date. I simply get a list of forecast data. How am I supposed to know which forecast corresponds to which day? Does the list contain a forecast of a specific number of days (7 consecutive days?) including today and onward, or is it tomorrow and onward?

Here is a link to the documentation for the daily weather forecast:

http://openweathermap.org/forecast16

Here is a JSON editor to view the JSON response :

http://www.jsoneditoronline.org/

Here is an example response:

{"city":{"id":1172451,"name":"Lahore","coord":{"lon":74.343613,"lat":31.549721},"country":"PK","population":0},"cod":"200","message":0.0099,"cnt":5,"list":[{"dt":1438758000,"temp":{"day":31.45,"min":26.37,"max":31.45,"night":26.37,"eve":30.71,"morn":31.45},"pressure":984.75,"humidity":79,"weather":[{"id":801,"main":"Clouds","description":"few

clouds","icon":"02d"}],"speed":3.83,"deg":119,"clouds":20},{"dt":1438844400,"temp":{"day":26.39,"min":24.36,"max":29.98,"night":25.71,"eve":29.93,"morn":25.13},"pressure":986.81,"humidity":100,"weather":[{"id":502,"main":"Rain","description":"heavy

intensity

rain","icon":"10d"}],"speed":3.22,"deg":78,"clouds":56,"rain":28.51},{"dt":1438930800,"temp":{"day":31.44,"min":25.78,"max":33.25,"night":27.22,"eve":33.25,"morn":25.78},"pressure":988.04,"humidity":85,"weather":[{"id":501,"main":"Rain","description":"moderate

rain","icon":"10d"}],"speed":2.11,"deg":125,"clouds":20,"rain":3.22},{"dt":1439017200,"temp":{"day":28.41,"min":25.8,"max":31.69,"night":27.59,"eve":31.69,"morn":25.8},"pressure":990.43,"humidity":90,"weather":[{"id":501,"main":"Rain","description":"moderate

rain","icon":"10d"}],"speed":2.52,"deg":87,"clouds":92,"rain":7.27},{"dt":1439103600,"temp":{"day":31.35,"min":26.23,"max":33.56,"night":27.29,"eve":31.68,"morn":26.23},"pressure":987.94,"humidity":81,"weather":[{"id":500,"main":"Rain","description":"light

rain","icon":"10d"}],"speed":1.51,"deg":99,"clouds":44,"rain":2.59}]}

网友答案:

If i'm not wrong the dt is the timestamp of the day. You can give a look at Weatherlib. It is an open source library written by me that parse OWM data and other weather provider. Hope it helps you.

分享给朋友:
您可能感兴趣的文章:
随机阅读: