逐小时天气预报
逐小时天气预报Android SDK,提供全球城市未来24-168小时逐小时天气预报,包括:温度、天气状况、风力、风速、风向、相对湿度、大气压强、降水概率、露点温度、云量。
| 接口代码 | 接口 | 数据类 |
|---|---|---|
| weather24h | 24小时预报天气数据 | WeatherHourlyResponse |
| weather72h | 72小时预报天气数据 | WeatherHourlyResponse |
| weather168h | 168小时预报天气数据 | WeatherHourlyResponse |
参数
WeatherParameter
-
location(必选)需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如location=101010100或location=116.41,39.92 -
lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。 -
unit数据单位设置,可选值包括unit=m(公制单位,默认)和unit=i(英制单位)。更多选项和说明参考度量衡单位。
示例代码
WeatherParameter parameter = new WeatherParameter("101010100");
/**
* 获取24小时预报数据
*/
public void weather24h(WeatherParameter parameter, Callback<WeatherHourlyResponse> callback);
/**
* 获取72小时预报数据
*/
public void weather72h(WeatherParameter parameter, Callback<WeatherHourlyResponse> callback);
/**
* 获取168小时预报数据
*/
public void weather168h(WeatherParameter parameter, Callback<WeatherHourlyResponse> callback);
返回数据
WeatherHourlyResponse
-
code请参考状态码 -
updateTime当前API的最近更新时间 -
fxLink当前数据的响应式页面,便于嵌入网站或应用 -
hourly.fxTime预报时间 -
hourly.temp温度,默认单位:摄氏度 -
hourly.icon天气状况的图标代码,另请参考天气图标项目 -
hourly.text天气状况的文字描述,包括阴晴雨雪等天气状态的描述 -
hourly.wind360风向360角度 -
hourly.windDir风向 -
hourly.windScale风力等级 -
hourly.windSpeed风速,公里/小时 -
hourly.humidity相对湿度,百分比数值 -
hourly.precip当前小时累计降水量,默认单位:毫米 -
hourly.pop逐小时预报降水概率,百分比数值,可能为空 -
hourly.pressure大气压强,默认单位:百帕 -
hourly.cloud云量,百分比数值。可能为空 -
hourly.dew露点温度。可能为空 -
refer.sources原始数据来源,或数据源说明,可能为空 -
refer.license数据许可或版权声明,可能为空