接口说明
根据经纬度/城市名查询天气的结果
接口示例
http://api.map.baidu.com/telematics/v3/weather?location=北京&output=json&ak=yourkey
接口参数说明
返回结果
返回xml格式的数据
<CityWeatherResponse> <status>success</status> <date>2013-07-18</date> <results> <currentCity>北京市</currentCity> <weather_data> <date>周三(今天, 实时:24℃)</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℃~ 15℃</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: "周三(今天, 实时:24℃)", 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℃~ 15℃" }, { 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℃" } ] } ] }