天气预报 API,7天天气预报API,信息全,高精准天气API 接口说明

JSON 2017-06-09 14:24:10 18078

为了完善天气预报功能模块,我开发了一套数据量较为全的天气预报,主要为全国主要城市预报。地址为:https://www.sojson.com/tianqi/

首先首页是个定位功能,然后根据定位查询天气。当定位不准,或者定位到的城市没有在我的城市范围内,那么就采用本省的省会做为天气预报城市,这里比较粗糙。

天气预报效果图

天气预报,我设置了几个背景效果,分为:天晴,下雨,污染雾霾,下雪,等几个背景效果。

天气晴朗效果图:

天气下雨效果图

其他的自己体验。

天气API接口说明

接口链接:https://www.sojson.com/tianqi/api/1011-58414.shtml

参数说明: 1011-58414 ,第一个是省ID,第二个是城市ID。

返回说明:返回以  JSON  格式返回。

天气API 返回值如下:

{
    "updateTime": 1496988312667,
    "alert": "2017年06月09日06时安徽省安庆市太湖县发布雷电黄色预警",
    "temperature": 24.4,
    "rain": 0.1,
    "humidity": 97,
    "weatherInfo": "大雨",
    "feelst": 23.4,
    "icomfort": {
        "text": "温暖,较舒适",
        "color": "#00a44f",
        "value": "1"
    },
    "airpressure": 996,
    "speed": 1.9,
    "direct": "西南风",
    "power": "微风",
    "title": "6小时内我县可能发生雷电活动,请注意防范。",
    "description": "1.政府及相关部门按照职责做好防雷工作;\n2.密切关注天气,尽量避免户外活动。",
    "aqi": {
        "aqi": "26.0",
        "aq": "1",
        "info": "优",
        "description": "空气质量令人满意,基本无空气污染。",
        "color": "#32f43e"
    },
    "day7": [
        {
            "date": {
                "date": "今天",
                "md": "06月09日",
                "week": "星期五"
            },
            "day": {
                "wicon": "9",
                "wdesc": "大雨",
                "temp": "28℃",
                "direct": "南风",
                "wind": "微风"
            },
            "night": {
                "wicon": "8",
                "wdesc": "中雨",
                "temp": "23℃",
                "direct": "南风",
                "wind": "微风"
            },
            "details": {
                "hour": [
                    "17:00",
                    "20:00",
                    "23:00",
                    "10日02:00",
                    "05:00",
                    "08:00",
                    "11:00",
                    "14:00"
                ],
                "wicon": [
                    "8",
                    "8",
                    "8",
                    "7",
                    "7",
                    "8",
                    "7",
                    "7"
                ],
                "temp": [
                    "24.2℃",
                    "23.2℃",
                    "23.4℃",
                    "25.7℃",
                    "27.3℃",
                    "24.6℃",
                    "28.5℃",
                    "29.8℃"
                ],
                "rainfall": [
                    "5.5毫米",
                    "8.9毫米",
                    "3.9毫米",
                    "1毫米",
                    "0.5毫米",
                    "8毫米",
                    "2.3毫米",
                    "1.3毫米"
                ],
                "wind_speed": [
                    "0.4米/秒",
                    "0.6米/秒",
                    "1米/秒",
                    "1.8米/秒",
                    "3.1米/秒",
                    "3.4米/秒",
                    "3.7米/秒",
                    "2.6米/秒"
                ],
                "wind_direction": [
                    "东风",
                    "东南风",
                    "东南风",
                    "南风",
                    "西南风",
                    "西南风",
                    "西风",
                    "西风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "95.1%",
                    "95.6%",
                    "98%",
                    "97.1%",
                    "93.7%",
                    "83%",
                    "85.6%",
                    "94.7%"
                ],
                "cloudage": [
                    "90.7%",
                    "70%",
                    "72.9%",
                    "100%",
                    "85.5%",
                    "70%",
                    "70%",
                    "70%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        },
        {
            "date": {
                "date": "明 天",
                "md": "06月10日",
                "week": "星期六"
            },
            "day": {
                "wicon": "7",
                "wdesc": "小雨",
                "temp": "30℃",
                "direct": "西南风",
                "wind": "微风"
            },
            "night": {
                "wicon": "4",
                "wdesc": "雷阵雨",
                "temp": "21℃",
                "direct": "西南风",
                "wind": "微风"
            },
            "details": {
                "hour": [
                    "08:00",
                    "11:00",
                    "14:00",
                    "17:00",
                    "20:00",
                    "23:00",
                    "11日02:00",
                    "05:00"
                ],
                "wicon": [
                    "8",
                    "7",
                    "7",
                    "8",
                    "7",
                    "4",
                    "4",
                    "4"
                ],
                "temp": [
                    "24.6℃",
                    "28.5℃",
                    "29.8℃",
                    "27.6℃",
                    "26.2℃",
                    "24.3℃",
                    "24.1℃",
                    "22.6℃"
                ],
                "rainfall": [
                    "8毫米",
                    "2.3毫米",
                    "1.3毫米",
                    "6.1毫米",
                    "0.1毫米",
                    "0.5毫米",
                    "0.5毫米",
                    "0.3毫米"
                ],
                "wind_speed": [
                    "3.4米/秒",
                    "3.7米/秒",
                    "2.6米/秒",
                    "2米/秒",
                    "1.4米/秒",
                    "0.8米/秒",
                    "1.2米/秒",
                    "2.2米/秒"
                ],
                "wind_direction": [
                    "西南风",
                    "西风",
                    "西风",
                    "西南风",
                    "西南风",
                    "南风",
                    "南风",
                    "南风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "83%",
                    "85.6%",
                    "94.7%",
                    "94.9%",
                    "95%",
                    "98.7%",
                    "98.7%",
                    "96%"
                ],
                "cloudage": [
                    "70%",
                    "70%",
                    "70%",
                    "70%",
                    "42%",
                    "56.9%",
                    "99.9%",
                    "100%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        },
        {
            "date": {
                "date": "后 天",
                "md": "06月11日",
                "week": "星期日"
            },
            "day": {
                "wicon": "4",
                "wdesc": "雷阵雨",
                "temp": "25℃",
                "direct": "东北风",
                "wind": "4~5级"
            },
            "night": {
                "wicon": "4",
                "wdesc": "雷阵雨",
                "temp": "20℃",
                "direct": "东风",
                "wind": "4~5级"
            },
            "details": {
                "hour": [
                    "08:00",
                    "11:00",
                    "14:00",
                    "17:00",
                    "20:00",
                    "23:00",
                    "12日02:00",
                    "05:00"
                ],
                "wicon": [
                    "4",
                    "4",
                    "4",
                    "4",
                    "1",
                    "1",
                    "1",
                    "4"
                ],
                "temp": [
                    "21.2℃",
                    "24.8℃",
                    "22.5℃",
                    "22.4℃",
                    "22.3℃",
                    "21.8℃",
                    "21.4℃",
                    "20.8℃"
                ],
                "rainfall": [
                    "0.2毫米",
                    "1.2毫米",
                    "1.9毫米",
                    "0.1毫米",
                    "无降水",
                    "无降水",
                    "无降水",
                    "0.1毫米"
                ],
                "wind_speed": [
                    "3.4米/秒",
                    "2米/秒",
                    "1.4米/秒",
                    "1.1米/秒",
                    "1.5米/秒",
                    "1.5米/秒",
                    "1.6米/秒",
                    "1.5米/秒"
                ],
                "wind_direction": [
                    "西南风",
                    "西风",
                    "东北风",
                    "东北风",
                    "东风",
                    "东北风",
                    "东北风",
                    "东北风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "85.5%",
                    "93.5%",
                    "95.6%",
                    "99.8%",
                    "98.3%",
                    "99%",
                    "98.9%",
                    "98.5%"
                ],
                "cloudage": [
                    "99.4%",
                    "100%",
                    "100%",
                    "47.4%",
                    "45.6%",
                    "45.9%",
                    "55.3%",
                    "100%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        },
        {
            "date": {
                "md": "06月12日",
                "week": "星期一"
            },
            "day": {
                "wicon": "2",
                "wdesc": "阴",
                "temp": "25℃",
                "direct": "东风",
                "wind": "微风"
            },
            "night": {
                "wicon": "1",
                "wdesc": "多云",
                "temp": "19℃",
                "direct": "东北风",
                "wind": "微风"
            },
            "details": {
                "hour": [
                    "08:00",
                    "11:00",
                    "14:00",
                    "17:00",
                    "20:00",
                    "23:00",
                    "13日02:00",
                    "05:00"
                ],
                "wicon": [
                    "4",
                    "2",
                    "2",
                    "2",
                    "2",
                    "1",
                    "1",
                    "1"
                ],
                "temp": [
                    "20.2℃",
                    "21.4℃",
                    "24.8℃",
                    "22.7℃",
                    "23.4℃",
                    "22.8℃",
                    "22.2℃",
                    "19.4℃"
                ],
                "rainfall": [
                    "0.1毫米",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水"
                ],
                "wind_speed": [
                    "1.6米/秒",
                    "1.8米/秒",
                    "2.5米/秒",
                    "3米/秒",
                    "2.3米/秒",
                    "2米/秒",
                    "2米/秒",
                    "1.8米/秒"
                ],
                "wind_direction": [
                    "东北风",
                    "东北风",
                    "东北风",
                    "东北风",
                    "东风",
                    "东北风",
                    "东北风",
                    "东北风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "93.1%",
                    "80.2%",
                    "82.9%",
                    "89.2%",
                    "85%",
                    "88.6%",
                    "90.2%",
                    "93.8%"
                ],
                "cloudage": [
                    "91.1%",
                    "83.7%",
                    "95.4%",
                    "94.5%",
                    "94%",
                    "79.9%",
                    "79.9%",
                    "79.9%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        },
        {
            "date": {
                "md": "06月13日",
                "week": "星期二"
            },
            "day": {
                "wicon": "1",
                "wdesc": "多云",
                "temp": "26℃",
                "direct": "东北风",
                "wind": "4~5级"
            },
            "night": {
                "wicon": "1",
                "wdesc": "多云",
                "temp": "19℃",
                "direct": "东北风",
                "wind": "4~5级"
            },
            "details": {
                "hour": [
                    "08:00",
                    "11:00",
                    "14:00",
                    "17:00",
                    "20:00",
                    "23:00",
                    "14日02:00",
                    "05:00"
                ],
                "wicon": [
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1"
                ],
                "temp": [
                    "19.2℃",
                    "21.2℃",
                    "20.1℃",
                    "19.2℃",
                    "21.2℃",
                    "25.8℃",
                    "22.4℃",
                    "20.9℃"
                ],
                "rainfall": [
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水"
                ],
                "wind_speed": [
                    "2.1米/秒",
                    "2.1米/秒",
                    "2.3米/秒",
                    "2.1米/秒",
                    "1.8米/秒",
                    "3.3米/秒",
                    "1.8米/秒",
                    "2米/秒"
                ],
                "wind_direction": [
                    "东北风",
                    "东北风",
                    "东北风",
                    "东北风",
                    "东风",
                    "东北风",
                    "东北风",
                    "东北风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "91.4%",
                    "91.9%",
                    "92.1%",
                    "88.9%",
                    "85.8%",
                    "86.5%",
                    "89.4%",
                    "85.2%"
                ],
                "cloudage": [
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "72.5%",
                    "79.9%",
                    "79.9%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        },
        {
            "date": {
                "md": "06月14日",
                "week": "星期三"
            },
            "day": {
                "wicon": "1",
                "wdesc": "多云",
                "temp": "25℃",
                "direct": "东北风",
                "wind": "3~4级"
            },
            "night": {
                "wicon": "1",
                "wdesc": "多云",
                "temp": "20℃",
                "direct": "东北风",
                "wind": "3~4级"
            },
            "details": {
                "hour": [
                    "08:00",
                    "11:00",
                    "14:00",
                    "17:00",
                    "20:00",
                    "23:00",
                    "15日02:00",
                    "05:00"
                ],
                "wicon": [
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1"
                ],
                "temp": [
                    "20.6℃",
                    "24.8℃",
                    "23.2℃",
                    "22.9℃",
                    "22.6℃",
                    "21.9℃",
                    "21.8℃",
                    "21.6℃"
                ],
                "rainfall": [
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水"
                ],
                "wind_speed": [
                    "2米/秒",
                    "2.5米/秒",
                    "2.3米/秒",
                    "1.1米/秒",
                    "1.8米/秒",
                    "2米/秒",
                    "1.8米/秒",
                    "1.2米/秒"
                ],
                "wind_direction": [
                    "东北风",
                    "东风",
                    "东风",
                    "东北风",
                    "东北风",
                    "东北风",
                    "东北风",
                    "东北风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "77.2%",
                    "79.6%",
                    "81.1%",
                    "84%",
                    "83.2%",
                    "91.6%",
                    "90%",
                    "88.4%"
                ],
                "cloudage": [
                    "79.9%",
                    "65.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        },
        {
            "date": {
                "md": "06月15日",
                "week": "星期四"
            },
            "day": {
                "wicon": "1",
                "wdesc": "多云",
                "temp": "25℃",
                "direct": "东风",
                "wind": "微风"
            },
            "night": {
                "wicon": "10",
                "wdesc": "暴雨",
                "temp": "17℃",
                "direct": "无持续风向",
                "wind": "微风"
            },
            "details": {
                "hour": [
                    "08:00",
                    "11:00",
                    "14:00",
                    "17:00",
                    "20:00",
                    "23:00",
                    "16日02:00",
                    "05:00"
                ],
                "wicon": [
                    "1",
                    "1",
                    "1",
                    "1",
                    "1",
                    "2",
                    "2",
                    "2"
                ],
                "temp": [
                    "20.2℃",
                    "24.8℃",
                    "22.6℃",
                    "20.6℃",
                    "20.6℃",
                    "20.6℃",
                    "20.2℃",
                    "19.5℃"
                ],
                "rainfall": [
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水",
                    "无降水"
                ],
                "wind_speed": [
                    "1.6米/秒",
                    "1.5米/秒",
                    "1.6米/秒",
                    "0.1米/秒",
                    "1.6米/秒",
                    "1.2米/秒",
                    "1.5米/秒",
                    "1.9米/秒"
                ],
                "wind_direction": [
                    "东风",
                    "东风",
                    "东北风",
                    "东北风",
                    "东北风",
                    "北风",
                    "北风",
                    "东北风"
                ],
                "pressure": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [
                    "77%",
                    "79%",
                    "80.3%",
                    "81.7%",
                    "85.5%",
                    "89.4%",
                    "90%",
                    "84.7%"
                ],
                "cloudage": [
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "79.9%",
                    "100%",
                    "100%",
                    "91.4%"
                ],
                "visibility": [
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        }
    ]
}

返回值较大,主要就是对应的七天天气,以及七天的精准天气说明。下面为您把接口参数一一说明意思。

天气接口API 参数说明

{
    "updateTime": 1496988312667,//更新时间,一般1小时以内
    "alert": "2017年06月09日06时安徽省安庆市太湖县发布雷电黄色预警",//是否有天气预警
    "temperature": 24.4,//气温
    "rain": 0.1,//降水
    "humidity": 97,//相对湿度
    "weatherInfo": "大雨",//天气说明
    "feelst": 23.4,//体感温度
    "icomfort": {//舒适度
        "text": "温暖,较舒适",
        "color": "#00a44f",
        "value": "1"//舒适度级别
    },
    "airpressure": 996,//气压
    "speed": 1.9,//风速多少米/秒
    "direct": "西南风",//风向
    "power": "微风",//风力
    "title": "6小时内我县可能发生雷电活动,请注意防范。",//预警标题
    "description": "1.政府及相关部门按照职责做好防雷工作;\n2.密切关注天气,尽量避免户外活动。",//预警内容
    "aqi": {//空气质量
        "aqi": "26.0",//空气指数
        "aq": "1",//空气级别
        "info": "优",//空气指数对应级别描述
        "description": "空气质量令人满意,基本无空气污染。",//空气污染对人身伤害描述
        "color": "#32f43e"//对应的颜色表示
    },
	//七天的天气,这里列了一个,这是一个数组,一共有7个Element
    "day7": [
        {
            "date": {
                "date": "今天",//哪一天
                "md": "06月09日",//哪一天日期
                "week": "星期五"//星期
            },
            "day": {//白天
                "wicon": "9",//天气标示
                "wdesc": "大雨",//天气
                "temp": "28℃",//温度
                "direct": "南风",//风向
                "wind": "微风"//风大小
            },
            "night": {
                "wicon": "8",//天气标示
                "wdesc": "中雨",//天气
                "temp": "23℃",//温度
                "direct": "南风",//风向
                "wind": "微风"//风大小
            },
            "details": {
                "hour": [//对应当天8个时间段
                    "17:00",
                    "20:00",
                    "23:00",
                    "10日02:00",
                    "05:00",
                    "08:00",
                    "11:00",
                    "14:00"
                ],
                "wicon": [//对应当天8个时间段天气标示
                    "8",
                    "8",
                    "8",
                    "7",
                    "7",
                    "8",
                    "7",
                    "7"
                ],
                "temp": [//对应当天8个时间段温度
                    "24.2℃",
                    "23.2℃",
                    "23.4℃",
                    "25.7℃",
                    "27.3℃",
                    "24.6℃",
                    "28.5℃",
                    "29.8℃"
                ],
                "rainfall": [//对应当天8个时间段降水
                    "5.5毫米",
                    "8.9毫米",
                    "3.9毫米",
                    "1毫米",
                    "0.5毫米",
                    "8毫米",
                    "2.3毫米",
                    "1.3毫米"
                ],
                "wind_speed": [//对应当天8个时间段风速
                    "0.4米/秒",
                    "0.6米/秒",
                    "1米/秒",
                    "1.8米/秒",
                    "3.1米/秒",
                    "3.4米/秒",
                    "3.7米/秒",
                    "2.6米/秒"
                ],
                "wind_direction": [//对应当天8个时间段风向
                    "东风",
                    "东南风",
                    "东南风",
                    "南风",
                    "西南风",
                    "西南风",
                    "西风",
                    "西风"
                ],
                "pressure": [//对应当天8个时间段气压
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ],
                "humidity": [//对应当天8个时间段湿度
                    "95.1%",
                    "95.6%",
                    "98%",
                    "97.1%",
                    "93.7%",
                    "83%",
                    "85.6%",
                    "94.7%"
                ],
                "cloudage": [//对应当天8个时间段云量
                    "90.7%",
                    "70%",
                    "72.9%",
                    "100%",
                    "85.5%",
                    "70%",
                    "70%",
                    "70%"
                ],
                "visibility": [//对应当天8个时间段可见度
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-",
                    "-"
                ]
            }
        }
		//这里还有6个,省略了,一样
    ]
}

个人使用,请勿商用。

版权所属:SO JSON在线解析

原文地址:https://www.sojson.com/blog/237.html

转载时必须以链接形式注明原始出处及本声明。

本文主题:

如果本文对你有帮助,那么请你赞助我,让我更有激情的写下去,帮助更多的人。

关于作者
一个低调而闷骚的男人。
相关文章
免费天气API,全国天气 JSON API接口,可以获取五天气预报
天气API,全国天气 JSON API接口,可以获取十五天的天气预报
免费天气API天气JSON API,不限次数获取十五天的天气预报
天气免费API接口天气API接口请求讲解及源码下载
公安局网站备案信息查询API,免费查询公安网备 API 代码说明
Java API接口返回不是JSON的解决方案,SpringMVC返回JSON配置。
Elasticsearch Java API 获取version,以及数据_version的介绍
Elasticsearch 分词,Elasticsearch Java API 分词 操作
使用七牛云存储实现图片API,自动删除图片方案合集
新浪短链(t.cn)最新申请官方API的方法讲解。
最新文章
PHP变量剖析 4
SQL全外连接剖析 119
SQL自然连接剖析 147
springboot启动原理 245
SQL右连接【RIGHT JOIN】详解及图解 450
SQL左链接【LEFT JOIN】详解及图解 357
SQL非等值连接剖析 262
SQL等链接剖析 291
SQL内连接详解及图解 385
python之numpy常用的100种数值相关方法及代码示例 231
最热文章
最新MyEclipse8.5注册码,有效期到2020年 (已经更新) 679222
苹果电脑Mac怎么恢复出厂系统?苹果系统怎么重装系统? 674561
免费天气API,全国天气 JSON API接口,可以获取五天的天气预报 599008
免费天气API,天气JSON API,不限次数获取十五天的天气预报 565182
Jackson 时间格式化,时间注解 @JsonFormat 用法、时差问题说明 551699
我为什么要选择RabbitMQ ,RabbitMQ简介,各种MQ选型对比 509186
Elasticsearch教程(四) elasticsearch head 插件安装和使用 479635
Jackson 美化输出JSON,优雅的输出JSON数据,格式化输出JSON数据... ... 262798
Java 信任所有SSL证书,HTTPS请求抛错,忽略证书请求完美解决 244092
Elasticsearch教程(一),全程直播(小白级别) 225115
支付扫码

所有赞助/开支都讲公开明细,用于网站维护:赞助名单查看

查看我的收藏

正在加载... ...