前言:
现时我们对“天气软件下载天气软件”大体比较注重,大家都需要了解一些“天气软件下载天气软件”的相关资讯。那么小编同时在网摘上汇集了一些关于“天气软件下载天气软件””的相关内容,希望你们能喜欢,大家快快来了解一下吧!#智己的十万种热爱#
高德天气API
高德地图为我们提供了一套API,可以基于提供的地理信息搭建地图,导航,天气在内的各种应用
天气查询API服务地址
URL:
请求方式:GET
parameters 代表的参数包括必填参数和可选参数。所有参数均使用和号字符(&)进行分隔。下面的列表枚举了这些参数及其使用规则。
key
请求服务权限标识
用户在高德地图官网 申请 web 服务 API 类型 KEY
必填
无
city
城市编码
输入城市的 adcode,adcode 信息可参考 城市编码表
必填
无
extensions
气象类型
可选值:base/all
base:返回实况天气
all:返回预报天气
可选
无
output
返回格式
可选值:JSON,XML
可选
JSON
{ "status": "1", "count": "1", "info": "OK", "infocode": "10000", "forecasts": [ { "city": "东城区", "adcode": "110101", "province": "北京", "reporttime": "2024-12-25 20:37:03", "casts": [ { "date": "2024-12-25", "week": "3", "dayweather": "晴", "nightweather": "晴", "daytemp": "6", "nighttemp": "-4", "daywind": "北", "nightwind": "北", "daypower": "1-3", "nightpower": "1-3", "daytemp_float": "6.0", "nighttemp_float": "-4.0" }, { "date": "2024-12-26", "week": "4", "dayweather": "晴", "nightweather": "晴", "daytemp": "3", "nighttemp": "-5", "daywind": "西北", "nightwind": "西北", "daypower": "1-3", "nightpower": "1-3", "daytemp_float": "3.0", "nighttemp_float": "-5.0" }, { "date": "2024-12-27", "week": "5", "dayweather": "晴", "nightweather": "晴", "daytemp": "3", "nighttemp": "-6", "daywind": "西北", "nightwind": "西北", "daypower": "1-3", "nightpower": "1-3", "daytemp_float": "3.0", "nighttemp_float": "-6.0" }, { "date": "2024-12-28", "week": "6", "dayweather": "晴", "nightweather": "晴", "daytemp": "5", "nighttemp": "-7", "daywind": "西南", "nightwind": "西南", "daypower": "1-3", "nightpower": "1-3", "daytemp_float": "5.0", "nighttemp_float": "-7.0" } ] } ]}
返回的北京地区天气数据
基于此,我们我们创建一个ETS的对象来接收这些信息
export class cast { private date: string; private week: number; private dayweather: string; private nightweather: string; private daytemp: number; private nighttemp: number; private daywind: string; private nightwind: string; private daypower: string; private nightpower: string; private daytemp_float: number; private nighttemp_float: number; constructor(date: string, week: number, dayweather: string, nightweather: string, daytemp: number, nighttemp: number, daywind: string, nightwind: string, daypower: string, nightpower: string, daytemp_float: number, nighttemp_float: number) { this.date = date; this.week = week; this.dayweather = dayweather; this.nightweather = nightweather; this.daytemp = daytemp; this.nighttemp = nighttemp; this.daywind = daywind; this.nightwind = nightwind; this.daypower = daypower; this.nightpower = nightpower; this.daytemp_float = daytemp_float; this.nighttemp_float = nighttemp_float; }}
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #天气软件下载天气软件