0%

高德开放平台天气查询API

高德开放平台下的天气查询接口文档

https://lbs.amap.com/api/webservice/guide/api/weatherinfo

注册开发者账号,获取Key

1
https://restapi.amap.com/v3/weather/weatherInfo?parameters

parameters代表的参数包括必填参数和可选参数。

https://restapi.amap.com/v3/weather/weatherInfo?key=[key]&city=310115

返回结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"lives": [
{
"province": "上海",
"city": "浦东新区",
"adcode": "310115",
"weather": "多云",
"temperature": "6",
"winddirection": "北",
"windpower": "≤3",
"humidity": "56",
"reporttime": "2020-01-12 17:57:21"
}
]
}

百度api是jsonp的方式获取数据,而高德地图的api是允许跨域的。