任意时间点的全球太阳高度及方位角接口,为安全和智能驾驶、房屋建设提供数据支持。
请求URL
太阳高度角 HTTP GET
- 商业版
https://api.qweather.net/v7/astronomy/solar-elevation-angle?{请求参数}
日出日落、月升月落和月相 HTTP GET
- 商业版
https://api.qweather.com/v7/astronomy/sunmoon?{请求参数}
- 开发版
https://devapi.qweather.com/v7/astronomy/sunmoon?{请求参数}
请求参数
请求参数包括必选和可选参数,如不填写可选参数将使用其默认值,参数之间使用&
进行分隔。
location 必选
太阳高度角是基于经纬度测量的,需要填写以逗号分隔的经度/纬度坐标(十进制),例如: location=116.41,39.92
data 必选
查询日期,格式为yyyyMMdd,例如 date=20170809
time 必选
查询时间,格式为HHmm,24 时制,例如 time=1230
tz 必选
查询地区所在时区,例如tz=0800
或tz=-0530
alt 必选
海拔高度,单位为米,例如alt=43
key 必选
用户认证key,请参考如何获取你的KEY。支持数字签名方式进行认证,推荐使用。例如 key=123456789ABC
返回数据
参数 | 描述 | 示例值 |
---|---|---|
code | API状态码,具体含义请参考状态码 | 200 |
solarElevationAngle | 太阳高度角 | 89 |
solarAzimuthAngle | 太阳方位角,正北顺时针方向角度 | 190 |
solarHour | 太阳时 | 0923 |
hourAngle | 时角 | -45.5 |
refer.sources | 原始数据来源,可能为空 | |
refer.license | 数据许可证 |
请求和返回示例
日出日落、月升月落和月相
// 北京日出日落、月升月落和月相
// 商业版 https://api.qweather.com/v7/astronomy/sunmoon?location=101010100&date=20200610&key=xxx
// 开发版 https://devapi.qweather.com/v7/astronomy/sunmoon?location=101010100&date=20200610&key=xxx
// 请将示例请求URL中的KEY更换成你自己的KEY,date更换为当天或未来60天任意日期
{
"code": "200",
"updateTime": "2020-06-14T16:57+08:00",
"fxLink": "https://www.qweather.com/weather/beijing-101010100.html",
"daily": [
{
"fxDate": "2020-06-14",
"sunrise": "04:45",
"sunset": "19:44",
"moonrise": "01:05",
"moonset": "12:53",
"tempMax": "35",
"tempMin": "22",
"iconDay": "100",
"textDay": "晴",
"iconNight": "150",
"textNight": "晴",
"wind360Day": "358",
"windDirDay": "北风",
"windScaleDay": "1-2",
"windSpeedDay": "8",
"wind360Night": "234",
"windDirNight": "西南风",
"windScaleNight": "1-2",
"windSpeedNight": "6",
"humidity": "22",
"precip": "0.0",
"pressure": "1001",
"vis": "25",
"uvIndex": "11"
},
{
"fxDate": "2020-06-15",
"sunrise": "04:45",
"sunset": "19:45",
"moonrise": "01:29",
"moonset": "13:51",
"tempMax": "36",
"tempMin": "22",
"iconDay": "100",
"textDay": "晴",
"iconNight": "150",
"textNight": "晴",
"wind360Day": "6",
"windDirDay": "北风",
"windScaleDay": "1-2",
"windSpeedDay": "2",
"wind360Night": "220",
"windDirNight": "西南风",
"windScaleNight": "1-2",
"windSpeedNight": "5",
"humidity": "30",
"precip": "0.0",
"pressure": "999",
"vis": "25",
"uvIndex": "11"
},
{
"fxDate": "2020-06-16",
"sunrise": "04:45",
"sunset": "19:45",
"moonrise": "01:52",
"moonset": "14:49",
"tempMax": "35",
"tempMin": "24",
"iconDay": "100",
"textDay": "晴",
"iconNight": "150",
"textNight": "晴",
"wind360Day": "235",
"windDirDay": "西南风",
"windScaleDay": "3-4",
"windSpeedDay": "18",
"wind360Night": "206",
"windDirNight": "西南风",
"windScaleNight": "1-2",
"windSpeedNight": "5",
"humidity": "30",
"precip": "0.0",
"pressure": "994",
"vis": "25",
"uvIndex": "11"
}
],
"refer": {
"sources": [
"Weather China"
],
"license": [
"commercial license"
]
}
}