百度提供天气预报查询接口API,可以根据经纬度/城市名查询天气情况,我们可以在微信公众平台开发中调用这一接口。

接口说明

根据经纬度/城市名查询天气的结果

接口示例

http://api.map.baidu.com/telematics/v3/weather?location=北京&output=json&ak=5slgyqGDENN7Sy7pw29IUvrZ

接口参数说明

参数类型 参数名称 是否必须 具体描述
String location true 输入城市名或经纬度,城市名称如:北京或者131,经纬度格式为lng,lat坐标如: location=116.305145,39.982368;全国值为all,返回省会城市自治区,港澳台天气情况多城市天气预报中间"|"分 隔,location=116.305145,39.982368| 122.305145,36.982368|….
String output false 输出的数据格式,默认为xml格式,当output设置为’json’时,输出的为json格式的数据;
String coord_type false 请求参数坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02、wgs84。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。wgs84表示gps获取的坐标。

返回结果

参数名称 含义 说明
currentCity 当前城市 返回城市名
status 返回结果状态信息  
date 当前时间 年-月-日
results 天气预报信息 白天可返回近期3天的天气情况(今天、明天、后天)、晚上可返回近期4天的天气情况(今天、明天、后天、大后天)
results.currentCity 当前城市  
results.weather_data weather_data.date 天气预报时间  
weather_data.dayPictureUrl 白天的天气预报图片url  
weather_data.nightPictureUrl 晚上的天气预报图片url  
weather_data.weather 天气状况 所有天气情况(”|”分隔符):晴|多云|阴|阵雨|雷阵雨|雷阵雨伴有冰雹|雨夹雪|小雨|中雨|大雨|暴雨|大暴雨|特大暴雨|阵雪|小雪| 中雪|大雪|暴雪|雾|冻雨|沙尘暴|小雨转中雨|中雨转大雨|大雨转暴雨|暴雨转大暴雨|大暴雨转特大暴雨|小雪转中雪|中雪转大雪|大雪转暴雪|浮 尘|扬沙|强沙尘暴|霾
weather_data.wind 风力  
weather_data.temperature 温度  

返回xml格式的数据

<CityWeatherResponse><status>success</status><date>2013-07-18</date><results><currentCity>北京市</currentCity><weather_data><date>周三</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>多云</weather><wind>微风</wind><temperature>23℃</temperature><date>周四</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/leizhenyu.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/zhongyu.png</nightPictureUrl><weather>雷阵雨转中雨</weather><wind>微风</wind><temperature>29~22℃</temperature><date>周五</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/yin.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>阴转多云</weather><wind>微风</wind><temperature>31~23℃</temperature><date>周六</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>多云</weather><wind>微风</wind><temperature>31~24℃</temperature></weather_data><currentCity>合肥市</currentCity><weather_data><date>周三</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>多云</weather><wind>东风3-4级</wind><temperature>27℃</temperature><date>周四</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>多云</weather><wind>东北风3-4级</wind><temperature>35~27℃</temperature><date>周五</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>多云</weather><wind>南风</wind><temperature>35~27℃</temperature><date>周六</date><dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl><weather>多云</weather><wind>东风</wind><temperature>34~27℃</temperature></weather_data></results>
</CityWeatherResponse>
<weather>阵雨</weather>
<wind>东北风3-4级</wind>
<temperature>18℃</temperature>
</result>
</results>
</CityWeatherResponse>

返回json格式的数据

{error: 0,status: "success",date: "2013-07-17",results: [{currentCity: "北京市",weather_data: [{date: "今天(周三)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "多云",wind: "微风",temperature: "23℃"},{date: "明天(周四)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/leizhenyu.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/zhongyu.png",weather: "雷阵雨转中雨",wind: "微风",temperature: "29~22℃"},{date: "后天(周五)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/yin.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "阴转多云",wind: "微风",temperature: "31~23℃"},{date: "大后天(周六)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "多云",wind: "微风",temperature: "31~24℃"}]},{currentCity: "合肥市",weather_data: [{date: "今天(周三)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "多云",wind: "东风3-4级",temperature: "27℃"},{date: "明天(周四)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "多云",wind: "东北风3-4级",temperature: "35~27℃"},{date: "后天(周五)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "多云",wind: "南风",temperature: "35~27℃"},{date: "大后天(周六)",dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",weather: "多云",wind: "东风",temperature: "34~27℃"}]}]
}

百度天气预报接口使用详细相关推荐

  1. android百度天气预报接口,用百度天气接口的实现安卓天气预报(json数据)

    代码地址: 具体思路: 1.写一个线程,其中city_str就是城市名,例如 city_str="宁波"; 2.然后通过线程取百度天气接口json数据 (注意不要用ie开这个网址, ...

  2. 百度天气预报接口介绍

    百度提供天气预报查询接口API,可以根据经纬度/城市名查询天气情况,我们可以在微信公众平台开发中调用这一接口. 接口说明 根据经纬度/城市名查询天气的结果 接口示例 http://api.map.ba ...

  3. python爬百度翻译-爬虫 python爬取百度翻译接口 超详细附源码

    前言 今天教大家如何利用 firefox 分析百度翻译的接口,并用python爬取接口.大家学会后可以干一些有趣的事情,比如做一个自己的翻译软件. 具体内容 1 - 找到URL接口 进入百度翻译的网址 ...

  4. 百度OCR接口使用详细教程

    如何把图片.PDF文件中的文字进行识别提取,这个问题仿佛困扰了我们很多年,直到现在,当急需OCR功能时也没有一个快速.高效且免费的在线工具或软件能马上拿来用. 前阵子的工作中正好有这个需求,我要把一篇 ...

  5. java百度天气接口解析_Java调用天气接口(百度天气)解析返回的JSON数据

    简介:本文详细讲述了通过Java调用百度天气接口的方法,取得返回的JSON格式的数据,并且通过第三方包解析JSON格式的数据. 通过百度天气API调用网络编程接口接收返回的JSON格式的数据. 关于百 ...

  6. 微信公众系列之百度天气预报开发

     1.登录百度ak申请: http://lbsyun.baidu.com/apiconsole/key 2.实现天气信息功能 baiduWeather.php <?php /*** 使用百度 ...

  7. 百度天气预报API接口的一个坑

    由于疫情的关系不能出门,所以在家学习微信小程序的开发,利用百度天气预报API接口来获取天气数据,折腾了一天,总是获取不到天气数据,搞得我一头雾水... 今天我下载了百度的demo程序,利用里面提供的J ...

  8. php调用天气预报接口,PHP调用百度天气接口API实现查询实时天气

    现在,不用守着晚上7点半的时间去看第二天的天气预报,只要你有手机,有网络,便可以轻松查询实时天气,可你知道怎么用PHP实现的吗?本文将带大家学习一种调用百度天气接口的方式,直接在PHP上查看实时天气, ...

  9. 微信小程序开发之天气预报,调用百度天气接口,显示温馨提示和之后的天气

    效果预览 页面功能介绍 此天气预报功能首先获取用户当前位置城市名,对于获取当前位置城市名和百度天气ak申请有疑问可以参考之前文章,然后根据城市名调用百度天气接口返回天气各项数据,最后对返回的数据进行处 ...

最新文章

  1. 用神经网络分类无理数2**0.5和3**0.5
  2. 某大型数据中心离心式冷水机组 控制板UPS电源改造项目案例分享
  3. 【收藏】Keepalived+Nginx高可用配置(偏nginx配置)
  4. 操作系统(概述、组成)、用户态、内核态
  5. python关联分析引擎_PowerBI x Python 之关联分析(上)
  6. JavaScript学习笔记02【基础——对象(Function、Array、Date、Math)】
  7. 【专升本计算机】专升本计算机期末考试复习题(B卷附答案)
  8. min里所有的参数都不存在_高中生物所有的考点难点,其实都在你不仔细看的课本里,必修1-3超强记忆手册!...
  9. 如何将html转为report,如何使用XtraReport将报表导出为HTML
  10. 第10课:Spark Streaming源码解读之流数据不断接收全生命周期彻底研究和思考
  11. 用python计算1~100的阶乘之和_在Python中递归函数调用举例and匿名函数lambda求1~100的和及计算阶乘举例...
  12. Python入门--集合元素的判断(in,not in集合元素的增加(add()update())集合元素的删除(remove(),discard(),pop(),clear())遍历(for in)
  13. 2020FME博客大赛——基于FME的海量数据点高效率抽稀技术及实现
  14. Keysight34401数字多用表远程遥控读取数据
  15. 怎么让maillog日志记录smtp是使用25端口还是465端口(SSL加密方式)
  16. 学无止境,京东活动自动领取脚本
  17. 使用xpath,正则表达式爬取豆瓣top250电影信息
  18. snappy流式编解码总结
  19. 华为鸿蒙2.0系统电脑安装步骤,华为鸿蒙系统2.0怎么安装,鸿蒙系统2.0安装教程...
  20. SSM框架项目:米米商城后台管理系统

热门文章

  1. SpringBoot + MyBatis-Plus + Shiro授权认证
  2. Python爬虫,爬取51job上有关大数据的招聘信息
  3. 管理员技术(二): 访问练习用虚拟机、 命令行基础技巧 、 挂载并访问光盘设备、ls列表及文档创建、复制删除移动...
  4. 【Java】如何检测、替换4个字节的utf-8编码(此范围编码包含emoji表情)
  5. 【FGUI】监听事件龙场悟道心得
  6. LSF - 提交GUI应用到LSF无法运行,报错Failed to connect to socket /tmp/dbus-xxxxxxxxx: Connection refused
  7. echart ——正负条形图
  8. Hexo图片外链生成专用文章
  9. android源码大放送啦(实战开发必备)
  10. 单片机c语言100例 的案例,51单片机C语言100个实例 [推荐下载】