小时天气预报

获取指定经纬度位置的每小时天气预报,最多240小时,1公里分辨率,覆盖全球任意地点。

每小时预报包括:天气现象、温度、体感温度、相对湿度、风向和风速、阵风风速、降水量和概率、海平面气压、能见度、露点温度、云量、紫外线指数等。

请求路径#

GET /weather/v1/hourly/{latitude}/{longitude}

参数#

路径参数

  • latitude 必选
    number
    所需位置的纬度。十进制,最多支持小数点后两位。例如 39.92
  • longitude 必选
    number
    所需位置的经度。十进制,最多支持小数点后两位。例如 116.41

查询参数

  • hours
    integer
    预报小时数,支持 1-240 小时,默认返回 24 小时
  • localTime
    boolean

    是否返回查询地点的本地时间

    可选值: false UTC时间(默认),true 本地时间

  • lang
    string

请求示例#

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/weather/v1/hourly/39.92/116.41'

请将your_token替换为你的JWT身份认证,将your_api_host替换为你的API Host

试一下

返回数据#

{
  "metadata": {
    "tag": "dabb37d79f0ba4498d5b92c873d33c862921eb1cb688181b84b3948306ea66bc",
    "attributions": [
      "https://developer.qweather.com/attribution.html"
    ]
  },
  "hours": [
    {
      "forecastTime": "2024-05-31T03:00Z",
      "condition": {
        "text": "Overcast",
        "code": "104"
      },
      "temperature": {
        "value": 31.12,
        "unit": "°C"
      },
      "feelsLike": {
        "value": 34.31,
        "unit": "°C"
      },
      "humidity": 0.76,
      "wind": {
        "direction": {
          "degree": 215,
          "compass": "sw"
        },
        "speed": {
          "value": 3.42,
          "unit": "m/s"
        },
        "scale": 3
      },
      "windGust": {
        "value": 8.16,
        "unit": "m/s"
      },
      "precipitation": {
        "amount": {
          "value": 0.09,
          "unit": "mm"
        },
        "intensity": {
          "value": 0.09,
          "unit": "mm/h"
        },
        "probability": 0.31,
        "type": "rain"
      },
      "pressure": {
        "value": 1001.5,
        "unit": "hPa"
      },
      "visibility": {
        "value": 14780,
        "unit": "m"
      },
      "dewPoint": {
        "value": 26.44,
        "unit": "°C"
      },
      "cloudCover": 0.92,
      "uvIndex": 6
    },
    {
      "forecastTime": "2024-05-31T04:00Z",
      "condition": {
        "text": "Cloudy",
        "code": "101"
      },
      "temperature": {
        "value": 31.01,
        "unit": "°C"
      },
      "feelsLike": {
        "value": 34.34,
        "unit": "°C"
      },
      "humidity": 0.77,
      "wind": {
        "direction": {
          "degree": 217,
          "compass": "sw"
        },
        "speed": {
          "value": 3.28,
          "unit": "m/s"
        },
        "scale": 2
      },
      "windGust": {
        "value": 8.04,
        "unit": "m/s"
      },
      "precipitation": {
        "amount": {
          "value": 0.21,
          "unit": "mm"
        },
        "intensity": {
          "value": 0.21,
          "unit": "mm/h"
        },
        "probability": 0.3,
        "type": "rain"
      },
      "pressure": {
        "value": 1000.8,
        "unit": "hPa"
      },
      "visibility": {
        "value": 14630,
        "unit": "m"
      },
      "dewPoint": {
        "value": 26.58,
        "unit": "°C"
      },
      "cloudCover": 0.61,
      "uvIndex": 7
    }
  ]
}
  • metadata
    object
    • tag
      string
      数据唯一标识
    • attributions
      array
      数据归因信息或声明,必须与当前数据共同显示
  • hours
    array
    逐小时天气预报列表
    • forecastTime
      date-time
      预报时间
    • condition
      object
      • text
        string
        天气现象的本地化描述
      • code
        string
        天气现象代码
    • temperature
      object
      温度数据
      • value
        number
        数值
      • unit
        string
    • feelsLike
      object
      体感温度
      • value
        number
        数值
      • unit
        string
    • humidity
      number
      相对湿度,取值范围 [0, 1]
    • wind
      object
      风的数据
      • direction
        object
        • degree
          number
          风向角度,取值范围 [0, 359]
        • compass
          string

          风向的方位代码

          可选值: n, nne, ne, ene, e, ese, se, sse, s, ssw, sw, wsw, w, wnw, nw, nnw, none, vrb

      • speed
        object
        风速
        • value
          number
          数值
        • unit
          string
      • scale
        number
    • windGust
      object
      阵风风速
      • value
        number
        数值
      • unit
        string
    • precipitation
      object
      降水数据
      • amount
        object
        当前数据时段内的累计降水量
        • value
          number
          数值
        • unit
          string
      • intensity
        object
        降水强度
        • value
          number
          数值
        • unit
          string
      • type
        string
        降水类型代码: rain(雨)、snow(雪)、ice(冰粒或冻雨)、 mixed(混合降水)、none(无降水)、unknown(未知)
      • probability
        number
        预报降水数据,取值范围 [0, 1]
    • pressure
      object
      海平面气压
      • value
        number
        数值
      • unit
        string
    • visibility
      object
      能见度
      • value
        number
        数值
      • unit
        string
    • dewPoint
      object
      露点温度
      • value
        number
        数值
      • unit
        string
    • cloudCover
      number
      云量,取值范围 [0, 1]
    • uvIndex
      number
      紫外线指数,取值范围 [0, 15]