实时天气

获取指定经纬度位置的实时天气数据,1公里分辨率,覆盖全球任意地点,分钟级更新。

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

请求路径#

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

参数#

路径参数

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

查询参数

  • localTime
    boolean

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

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

  • lang
    string

请求示例#

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

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

试一下

返回数据#

{
  "metadata": {
    "tag": "03ec2ded05fa80a43df2664dd9e4a8f48f7cc4f97c6a81dfd736ae17098aba14",
    "attributions": [
      "https://developer.qweather.com/attribution.html"
    ]
  },
  "condition": {
    "text": "少云",
    "code": "102"
  },
  "temperature": {
    "value": 31.71,
    "unit": "°C"
  },
  "feelsLike": {
    "value": 33.64,
    "unit": "°C"
  },
  "humidity": 0.69,
  "wind": {
    "direction": {
      "degree": 226,
      "compass": "sw"
    },
    "speed": {
      "value": 4.74,
      "unit": "m/s"
    },
    "scale": 3
  },
  "windGust": {
    "value": 7.07,
    "unit": "m/s"
  },
  "precipitation": {
    "amount": {
      "value": 0,
      "unit": "mm"
    },
    "intensity": {
      "value": 0,
      "unit": "mm/h"
    },
    "type": "none"
  },
  "pressure": {
    "value": 1001.5,
    "unit": "hPa"
  },
  "visibility": {
    "value": 29020,
    "unit": "m"
  },
  "dewPoint": {
    "value": 25.36,
    "unit": "°C"
  },
  "cloudCover": 0.05,
  "uvIndex": 3
}
  • metadata
    object
    • tag
      string
      数据唯一标识
    • attributions
      array
      数据归因信息或声明,必须与当前数据共同显示
  • 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(未知)
  • 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]