小时天气预报
获取指定经纬度位置的每小时天气预报,最多240小时,1公里分辨率,覆盖全球任意地点。
每小时预报包括:天气现象、温度、体感温度、相对湿度、风向和风速、阵风风速、降水量和概率、海平面气压、能见度、露点温度、云量、紫外线指数等。
请求路径#
GET /weather/v1/hourly/{latitude}/{longitude}参数#
路径参数
-
latitude 必选number所需位置的纬度。十进制,最多支持小数点后两位。例如
39.92 -
longitude 必选number所需位置的经度。十进制,最多支持小数点后两位。例如
116.41
查询参数
-
hoursinteger预报小时数,支持
1-240小时,默认返回24小时 -
localTimeboolean
是否返回查询地点的本地时间
可选值:
falseUTC时间(默认),true本地时间 -
langstring
请求示例#
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
}
]
}-
metadataobject
-
tagstring数据唯一标识
-
attributionsarray数据归因信息或声明,必须与当前数据共同显示
-
-
hoursarray逐小时天气预报列表
-
forecastTimedate-time预报时间
-
conditionobject
-
textstring天气现象的本地化描述
-
codestring天气现象代码
-
-
temperatureobject温度数据
-
valuenumber数值
-
unitstring
-
-
feelsLikeobject体感温度
-
valuenumber数值
-
unitstring
-
-
humiditynumber相对湿度,取值范围
[0, 1] -
windobject风的数据
-
directionobject
-
degreenumber风向角度,取值范围
[0, 359] -
compassstring
风向的方位代码
可选值:
n,nne,ne,ene,e,ese,se,sse,s,ssw,sw,wsw,w,wnw,nw,nnw,none,vrb
-
-
speedobject风速
-
valuenumber数值
-
unitstring
-
-
scalenumber
-
-
windGustobject阵风风速
-
valuenumber数值
-
unitstring
-
-
precipitationobject降水数据
-
amountobject当前数据时段内的累计降水量
-
valuenumber数值
-
unitstring
-
-
intensityobject降水强度
-
valuenumber数值
-
unitstring
-
-
typestring降水类型代码:
rain(雨)、snow(雪)、ice(冰粒或冻雨)、mixed(混合降水)、none(无降水)、unknown(未知) -
probabilitynumber预报降水数据,取值范围
[0, 1]
-
-
pressureobject海平面气压
-
valuenumber数值
-
unitstring
-
-
visibilityobject能见度
-
valuenumber数值
-
unitstring
-
-
dewPointobject露点温度
-
valuenumber数值
-
unitstring
-
-
cloudCovernumber云量,取值范围
[0, 1] -
uvIndexnumber紫外线指数,取值范围
[0, 15]
-