国家气象局提供的天气预报接口(完整Json接口)
国家气象局提供的天气预报接口主要有三个,分别是:
http://www.weather.com.cn/data/sk/101010100.html
http://www.weather.com.cn/data/cityinfo/101010100.html
http://m.weather.com.cn/data/101010100.html
其中详细接口为:http://m.weather.com.cn/data/101010100.html
以下是http://m.weather.com.cn/data/101010100.html接口json格式提供,格式如下
{"weatherinfo":{
//基本信息
//fchh是系统更新时间
"city":"北京","city_en":"beijing","date_y":"2011年10月23 日","date":"辛卯年","week":"星期 日","fchh":"11","cityid":"101010100",
//6天内的温度
"temp1":"16℃~6℃","temp2":"16℃~3℃","temp3":"16℃~6℃","temp4":"14℃~6℃",
"temp5":"17℃~5℃","temp6":"18℃~8℃",
//6天内华氏度
"tempF1":"60.8℉~42.8℉","tempF2":"60.8℉~37.4℉","tempF3":"60.8℉~42.8℉",
"tempF4":"57.2℉~42.8℉","tempF5":"62.6℉~41℉","tempF6":"64.4℉~46.4℉",
//每日天气变化
"weather1":" 小雨转晴","weather2":"晴","weather3":"晴转阴","weather4":"多云转阴","weather5":"阴转 晴","weather6":"晴转多云",
//天气描述(图片序号)
"img1":"7","img2":"0","img3":"0","img4":"99","img5":"0","img6":"2","img7":"1",
"img8":"2","img9":"2","img10":"0","img11":"0","img12":"1","img_single":"7",
//天气描述(文字描述)
"img_title1":" 小雨","img_title2":"晴","img_title3":"晴","img_title4":"晴","img_title5":"晴",
"img_title6":"阴","img_title7":"多云","img_title8":"阴","img_title9":"阴","img_title10":"晴",
"img_title11":"晴","img_title12":"多 云","img_title_single":"小雨",
//风向描述
"wind1":"北风4-5级","wind2":"北风3-4级转微 风","wind3":"微风","wind4":"微风","wind5":"微风",
"wind6":"微风","fx1":"北 风","fx2":"北风",
//风力描述
"fl1":"4-5级","fl2":"3-4级转小于3级","fl3":"小于3级","fl4":"小于3 级","fl5":"小于3级","fl6":"小于3级",
//今天穿衣指数
"index":"温凉","index_d":"较凉爽,建议着夹衣加薄羊毛衫等春秋服 装。体弱者宜着夹衣加羊毛衫。因昼夜温差较大,注意增减衣服。",
//48小时内穿衣指数
"index48":"温凉","index48_d":"较凉爽,建议着夹衣加薄羊毛 衫等春秋服装。体弱者宜着夹衣加羊毛衫。因昼夜温差较大,注意增减衣服。",
//紫外线
"index_uv":"最弱","index48_uv":"中 等",
//洗车
"index_xc":"不宜",
//旅游
"index_tr":"适宜",
//人体舒适度
"index_co":"较舒 适",
//未知
"st1":"14","st2":"3","st3":"14","st4":"5","st5":"15","st6":"5",
//晨练
"index_cl":" 较不宜",
//晾衣
"index_ls":"不宜",
//过敏
"index_ag":"极不易发"}}
当天基础天气接口
http://www.weather.com.cn/data/cityinfo/101010100.html
以下是http://www.weather.com.cn/data/cityinfo/101010100.html接口提供是Json格式提供,数据如下:
//ptime为系统最后更新时间
{"weatherinfo":{"city":"北 京","cityid":"101010100","temp1":"16℃","temp2":"6℃","weather":"小雨转 晴","img1":"d7.gif","img2":"n0.gif","ptime":"11:00"}}
当天基础天气接口
http://www.weather.com.cn/data/sk/101010100.html
以下是http://www.weather.com.cn/data/sk/101010100.html接口提供是Json格式提供,数据如下:
//temp为摄氏度
//isRadar 应该是雷达返回成功标识
//Radar是雷达编号
//time是该数据更新时间
{"weatherinfo":{"city":"北京","cityid":"101010100","temp":"10","WD":"东北 风","WS":"4 级","SD":"56%","WSE":"4","time":"16:40","isRadar":"1","Radar":"JC_RADAR_AZ9010_JB"}}
字段名称
代码含义
city:城市名称 cityid:城市id day_y:当前时间
temp1:今天温度最低温和最高温 temp2:明天温度最低温和最高温
temp3:第三天温度最低温和最高温 temp4:第四天度最低温和最高温
temp5:第五天度最低温和最高温 temp6:第六天度最低温和最高温
weather1:今天天气描述 img1:今天白天温度图标
img3:明天白天温度图标 img5:第三天白天温度图标
img7:第四天白天温度图标 img9:第五天白天温度图标
img11:第六天白天温度图标
注意其中温度坐标字段(img1, img3, img5, img7, img9, img11)只是给出了图标的编号,需要拼接字符串来获取网络图片,比如得到img1,则图片地址为 http://m.weather.com.cn/img/b1.gif这个就是今天白天温度图标的图片网址,其中”b1.gif”就是图片的名字和样式,”b”表示这个图标是50*46像素,”1”就是”img”中的”1”,不同数字表示不同图标,获取图标后就可以通过Bitmap类型显示出来
public static List<Map<String, String>> getTodayWeather(String path) { List<Map<String, String>> list = new ArrayList<Map<String, String>>(); String json = null; Map<String, String> map; try { String line = getConnection(path); // 字符数组转换成字符串 if (line != null) { json = new String(line); // 这里是以对象的形式 JSONObject item1 = new JSONObject(json); // 得到对象中的对象 JSONObject item = item1.getJSONObject("weatherinfo"); // 城市名字,阴天,3-4°,北风三级,湿度,日期 String city = item.getString("city"); String temp = item.getString("temp"); String wind = item.getString("WD") + item.getString("WS"); String wet = item.getString("SD"); String time = item.getString("time"); // 添加到MAP中 map = new HashMap<String, String>(); map.put("city", city); map.put("temp", temp); map.put("wind", wind); map.put("wet", wet); map.put("time", time); list.add(map); } else { System.out.println("获取留数据失败!"); } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list;
}
国家气象局提供的天气预报接口(完整Json接口)相关推荐
- Android:国家气象局提供的天气预报接口(完整Json接口)
这里是我做的一个天气预报APP:天气预报源码下载 国家气象局提供的天气预报接口主要有三个,分别是: http://www.weather.com.cn/data/sk/101010100.html ( ...
- 国家气象局提供的天气预报接口
国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...
- 气象接口返回图标_国家气象局提供的天气预报接口及使用说明
接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data/cityinfo/10101 ...
- 开源免费天气预报接口API(国家气象局提供)
国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...
- 天气API-----开源免费天气预报接口API以及全国所有地区代码!!(国家气象局提供)
国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...
- 开源免费天气预报接口API以及全国所有地区代码!!(国家气象局提供)
国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...
- 开源免费天气预报接口API以及全国所有地区代码!!(国家气象局提供)_技术成长笔记_新浪博客...
国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...
- 气象接口返回图标_中国天气网接口返回json格式分析及接口(XML、图片接口)说明...
实时天气: city "北京"//城市 cityid "101010100"//城市编码 temp "17&qu ...
- 中国天气网接口返回json格式分析及接口(XML、图片接口)说明!
手机天气插件更新数据时某些天气插件更新时流量有点儿消耗稍大,所以还是自己动手丰衣足食啊,未来7天返回的流量(当然这个要看具体天气和生活指数里返回的大小了关键是生活指数) 实时的: 中国天气网返回未来7 ...
最新文章
- 非法关机 mysql_一次非法关机造成mysql数据表损坏的例子
- mysql 1084_[LeetCode]1084. 销售分析III(Mysql,having+聚合函数)
- 201126阶段二单例数据库及MVC设计模式
- 年轻人,拼命奋斗还是保命要紧?
- 2013年08月13日
- Unity Text 插入超链接
- linux定时器tinner,第三章 套接字相关数据结构--基于Linux3.10
- POJ1769(线段树+DP)
- Python学习笔记-异常处理
- 解决SecureCRT连接linux超时后断开
- Turbo C 2.0
- ie8 升级页面html,IE8怎么升级到IE11 IE浏览器怎么升级
- Java类加载机制与反射 jvm学习
- Docker 和 Kubernetes了解一下
- 论文笔记(十八):Object Detection and Spatial Location Method for ... Based on 3D Virtual Geographical Scen
- IDLE的介绍和使用
- c语言上机试题倒计时,C语言课程实训-显示考试倒计时.doc
- 00后学习微积分,推荐访问袁萌专栏
- 带你认识网络世界,什么是网络协议、分层有什么好处
- 由Bitlocker问题引发的思考