逐小时天气预报

平台: API iOS Android

逐小时天气预报Android SDK,提供全球城市未来24-168小时逐小时天气预报,包括:温度、天气状况、风力、风速、风向、相对湿度、大气压强、降水概率、露点温度、云量。

接口代码 接口 数据类
weather24h 24小时预报天气数据 WeatherHourlyResponse
weather72h 72小时预报天气数据 WeatherHourlyResponse
weather168h 168小时预报天气数据 WeatherHourlyResponse

参数

WeatherParameter

  • location(必选)需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如 location=101010100location=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);

Response

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 数据许可或版权声明,可能为空