浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。

文档全面上新

更科技的视觉体验,更高效的页面结构,快前往体验吧!

体验新版


接口说明

    车联网API服务的各种能力后续将合并到Web API服务中。自2015年12月31日起,车联网API服务将不再向新用户提供服务支持。已有用户服务暂不受影响,请已使用了各种车联网API服务的开发者,尽快升级服务到Web API中使用。

根据城市,返回相应的交通事件信息。

接口示例

 http://api.map.baidu.com/telematics/v3/trafficEvent?location=北京&output=json&ak=E4805d16520de693a3fe707cdc962045

接口参数说明

参数类型 参数名称 是否必须 具体描述
String ak true 开发者密钥
String sn false 若用户所用ak的校验方式为sn校验时该参数必须。 (sn生成算法
String location true 输入城市名或经纬度,经纬度格式为 lng,lat
String output false 输出的数据格式,默认为xml格式,当output设置为’json’时,输出的为json格式的数据;
String coord_type false 请求参数坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02、wgs84。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。wgs84表示gps获取的坐标。
String out_coord_type false 返回结果输出时的坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。
String callback false 将json格式的返回值通过callback函数返回以实现jsonp功能。举例:callback=showLocation(JavaScript函数名)。

返回结果

参数名称 含义 说明
status 返回结果状态信息 请求状态,如果成功返回0,如果失败返回其他数字,详细见状态码附录。
currentCity 当前城市 返回城市名
datetime 当前时间 格式 年/月/日/时/分/秒
results.startTime 事件开始时间 格式 年/月/日/时/分/秒
results.endTime 事件结束时间 格式 年/月/日/时/分/秒
results.title 事件名称
results.description 事件描述
results.location 事件位置(经纬度)
results.location.lng 经度
results.location.lat 纬度
results.type 事件类型 0管制、1事故、2施工、3管制

返回xml格式的数据

<TrafficEventResponse>
<status>success</status>
<currentCity>北京</currentCity>
<dateTime>2013/07/23/18/32/41</dateTime>
<results>
<result>
<startTime>2013/03/08/10/51/00</startTime>
<endTime>2013/10/08/12/00/00</endTime>
<title>东四西大街1车道限行(长期)</title>
<description>东四西大街因为道路施工,导致1车道限行。</description>
<location>
<lng>116.420497</lng>
<lat>39.930511</lat>
</location>
<type>2</type>
</result>
<result>
<startTime>2013/01/01/00/00/00</startTime>
<endTime>2013/12/31/23/59/00</endTime>
<title>清华东路3车道限行(长期)</title>
<description>清华东路因为道路施工,导致3车道限行。</description>
<location>
<lng>116.37618</lng>
<lat>40.007609</lat>
</location>
<type>2</type>
</result>
</results>
</TrafficEventResponse>

返回json格式的数据

{
error: 0,
status: "success",
currentCity: "北京",
dateTime: "2013/07/23/18/33/46",
results: [
{
startTime: "2013/03/08/10/51/00",
endTime: "2013/10/08/12/00/00",
title: "东四西大街1车道限行(长期)",
description: "东四西大街因为道路施工,导致1车道限行。",
location: {
lng: 116.420497,
lat: 39.930511
},
type: "2"
}
]
}
  • 文档根本没法用

  • 文档水平很差

  • 文档水平一般

  • 文档不错

  • 文档写的很好

如发现文档错误,或对此文档有更好的建议,请在下方反馈。问题咨询请前往反馈平台提交工单咨询。

提交反馈

拖动标注工具

添加矩形标注

添加箭头标注

完成

取消