气象接口的开发和使用

来源:互联网 发布:java 生成zip压缩文件 编辑:程序博客网 时间:2024/05/16 16:37


1 中国气象局官方接口

http://smart.weather.com.cn/wzfw/smart/weatherapi.shtml

http://apistore.baidu.com/astore/serviceinfo/1454.html



2 国家气象科学数据共享服务平台

http://data.cma.cn/data/cdcindex/cid/6d1b5efbdcbf9a58.html


3 第三方平台

http://www.weatherdt.com/help.html?index=3


4 门户网站的气象接口支持

4.1  百度

http://api.map.baidu.com/telematics/v3/weather?location=嘉兴&output=json&ak=5slgyqGDENN7Sy7pw29IUvrZ
实例用法http://www.oschina.net/code/snippet_554046_35134
官方文档http://developer.baidu.com/map/carapi-7.htm
location:城市名或经纬度 ak:开发者密钥 output:默认xml


4.2 新浪

新浪天气频道为全国广大用户提供全国2000多个城市和国际15000个城市的天气预报.其中包含的服务有:历史气候查询、天气预报5天查询、重大天气新闻、及时发布灾害
预警等。新浪气象接口API是针对专业机构提供的开放性、简单易用性的应用接口,它容许技术人员在其提供的基本信息服务的基础上,进行二次开发,形成个性化的气象服务。
新浪气象信息的获取较为简单,只要按照指定格式的URL发送请求给新浪天气服务器,服务器就会返回携带天气预报的XML文档,技术人员针对XML进行解析后,把需要的气象信息提取出来后,再进行改进,就可以形成自己的气象服务。


获取新浪天气预报的XML文档,需要以如下的格式访问:
http://php.weather.sina.eom.cn/XML.php?city=%B4%F3%C1%AC&password=DJOYnieT8234jlsK&day=0


说明:其中查询参数city为所在城市,在上例的URL中%B4%F3%C1%AC代表的城市为大连.在新浪天气频道中可以查询到对应城市的编码方式。

password为新浪天气频道注册用户所拥有的注册码。day为查询日期的间隔。如0表示明天,即当前时间+l天;1表示后天,即当前时间+2天。


4.3 谷歌

http://googleweather.riaforge.org/

While Google Weather API is being used in iGoogle to get the weather information, the API itself is not official for public yet. There is some unofficial documentation online but there is no official documentation yet. Use it with caution.


GoogleWeather utilizes the Google Weather API. While Google Weather API is being used in iGoogle to obtain the weather information, the API itself is not officially public yet. Please do expect changes in the future. 


GoogleWeather accepts three parameters and they are as folows,
1) Place: This is a required field. You can pass in the zip code (i.e. 12203), City Name followed by State (i.e. Albany, NY), or City Name followed by Country Name (i.e. London, England).
2) Language: This is an optional field. You must pass in an ISO 639-1 Language Code. For a list of ISO 639-1 codes, please go to http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes. By default, it is set to English (i.e. en).
3) Unit: This is an optional field. You can pass in a C (Celsius) or an F (Fahrenheit). By default, it is set to F (i.e. Fahrenheit). 


https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes



5  开发者

http://blog.csdn.net/l_ch_g/article/details/8205817


6 相关技术要求

6.1 Json


6.2  Jdom


6.3 Google

https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes




原创粉丝点击