使用 openweathermap api,如何使用 javascript 获取某一天的平均温度。我知道我的能力有限,只能在接下来的 5 天内完成。我一直在寻找,但找不到一种方法来做到这一点,也没有看到其他人这样做。
最佳答案
您可以使用 API api.openweathermap.org/data/2.5/forecast?q={city name},{country code}
。请引用here了解更多详情。
您可以按城市名称搜索每 3 小时一次的 5 天天气预报。所有天气数据都可以JSON和XML格式获取。
https://openweathermap.org/forecast5
API call:
api.openweathermap.org/data/2.5/forecast?q={city name},{country code}
Parameters:
q city name and country code divided by comma, use ISO 3166 country codes
Examples of API calls:
api.openweathermap.org/data/2.5/forecast?q=London,us&mode=xml
关于javascript - OpenWeatherMap 获取当日平均气温,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45493426/