(→接口示例) |
|||
第1行: | 第1行: | ||
{{car-sidebar}} | {{car-sidebar}} | ||
− | ==接口说明== | + | |
+ | == 接口说明 == | ||
+ | <span style="color:red;"> 车联网API服务的各种能力后续将合并到Web API服务中。自2015年12月31日起,车联网API服务将不再向新用户提供服务支持。已有用户服务暂不受影响,请已使用了各种车联网API服务的开发者,尽快升级服务到Web API中使用。</span> | ||
根据起终点,返回途经路段的信息,包括主要路段、红绿灯、摄像头等 | 根据起终点,返回途经路段的信息,包括主要路段、红绿灯、摄像头等 | ||
− | ==接口示例== | + | == 接口示例 == |
− | http://api.map.baidu.com/telematics/v3/viaPath?origin=116.290993,40.004519&destination=116.38342,39.913348&output=json&ak=E4805d16520de693a3fe707cdc962045 | + | [http://api.map.baidu.com/telematics/v3/viaPath?origin=116.290993,40.004519&destination=116.38342,39.913348&output=json&ak=E4805d16520de693a3fe707cdc962045 http://api.map.baidu.com/telematics/v3/viaPath?origin=116.290993,40.004519&destination=116.38342,39.913348&output=json&ak=E4805d16520de693a3fe707cdc962045] |
− | ==接口参数说明== | + | == 接口参数说明 == |
{| | {| | ||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | ! width="100" | 参数类型 |
− | | | + | ! width="100" | 参数名称 |
− | | | + | ! width="100" | 是否必须 |
− | + | ! 具体描述 | |
|- | |- | ||
− | |String | + | | String |
− | | | + | | ak |
− | | | + | | true |
− | | | + | | 开发者密钥 |
|- | |- | ||
− | |String | + | | String |
− | | | + | | sn |
− | | | + | | false |
− | | | + | | 若用户所用ak的校验方式为sn校验时该参数必须。 ([http://developer.baidu.com/map/index.php?title=lbscloud/api/appendix sn生成算法]) |
|- | |- | ||
− | |String | + | | String |
− | | | + | | origin |
− | |true | + | | true |
− | |起点名称或经纬度 | + | | 起点名称或经纬度 |
|- | |- | ||
− | |String | + | | String |
− | | | + | | destination |
− | | | + | | true |
− | | | + | | 起点名称或经纬度 |
|- | |- | ||
− | |String | + | | String |
− | | | + | | output |
− | |false | + | | false |
− | | | + | | 输出的数据格式,默认为xml格式,当output设置为’json’时,输出的为json格式的数据; |
|- | |- | ||
− | |String | + | | String |
− | | | + | | coord_type |
− | |false | + | | false |
− | | | + | | 请求参数坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02、wgs84。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。wgs84表示gps获取的坐标。 |
|- | |- | ||
− | |String | + | | String |
− | |callback | + | | out_coord_type |
− | |false | + | | false |
− | |将json格式的返回值通过callback函数返回以实现jsonp功能。举例:callback=showLocation(JavaScript函数名)。 | + | | 返回结果输出时的坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。 |
+ | |- | ||
+ | | String | ||
+ | | callback | ||
+ | | false | ||
+ | | 将json格式的返回值通过callback函数返回以实现jsonp功能。举例:callback=showLocation(JavaScript函数名)。 | ||
|} | |} | ||
− | ==返回结果== | + | == 返回结果 == |
{| | {| | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | ! width="200" | 参数名称 |
− | | | + | ! width="200" | 含义 |
− | + | ! 说明 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | | | + | | status |
− | | | + | | 返回结果状态信息 |
− | | | + | | 请求状态,如果成功返回0,如果失败返回其他数字,详细见状态码附录。 |
|- | |- | ||
− | |results | + | | results |
− | | | + | | 路段结果 |
− | | | + | | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | |results.[item] | + | | results.[item] |
− | | | + | | |
− | | | + | | Item包括如下类型: mainRoad主要路段 entrance道路出入口 landMark途径地标 tollStation收费站 trafficLight红绿灯 serviceArea服务区 gasStation加油站 camera摄像头 other其他 carPark终点停车场 |
|- | |- | ||
− | |results.[item]. | + | | results.[item].name |
− | | | + | | 路段名称 |
− | | | + | | 如摄像头 |
|- | |- | ||
− | |results.[item].address | + | | results.[item].location |
− | |地址 | + | | 路段坐标(经纬度) |
− | |停车场的地址 | + | | |
+ | |- | ||
+ | | results.[item].location.lng | ||
+ | | 经度 | ||
+ | | | ||
+ | |- | ||
+ | | results.[item].location.lat | ||
+ | | 纬度 | ||
+ | | | ||
+ | |- | ||
+ | | results.[item].type | ||
+ | | 路段类型 | ||
+ | | 其中终点停车场模块carPark没有type类型,其余的参见附表1 | ||
+ | |- | ||
+ | | results.[item].speed | ||
+ | | 限速 | ||
+ | | 途经路段摄像头点限速,-1为无相关数据 | ||
+ | |- | ||
+ | | results.[item].direction | ||
+ | | 方向 | ||
+ | | 道路出入口的方向信息 | ||
+ | |- | ||
+ | | results.[item].address | ||
+ | | 地址 | ||
+ | | 停车场的地址 | ||
|} | |} | ||
− | ==返回xml格式的数据== | + | == 返回xml格式的数据 == |
− | + | <pre><ViaPath> | |
− | <pre> | + | |
− | <ViaPath> | + | |
<status>success</status> | <status>success</status> | ||
<results> | <results> | ||
第129行: | 第131行: | ||
</pre> | </pre> | ||
− | ==返回json格式的数据== | + | == 返回json格式的数据 == |
− | + | <pre>{ | |
− | <pre> | + | |
− | { | + | |
status: "success", | status: "success", | ||
results: { | results: { |
2020年1月14日 (二) 16:29的版本
接口说明
车联网API服务的各种能力后续将合并到Web API服务中。自2015年12月31日起,车联网API服务将不再向新用户提供服务支持。已有用户服务暂不受影响,请已使用了各种车联网API服务的开发者,尽快升级服务到Web API中使用。
根据起终点,返回途经路段的信息,包括主要路段、红绿灯、摄像头等
接口示例
http://api.map.baidu.com/telematics/v3/viaPath?origin=116.290993,40.004519&destination=116.38342,39.913348&output=json&ak=E4805d16520de693a3fe707cdc962045
接口参数说明
参数类型 | 参数名称 | 是否必须 | 具体描述 |
---|---|---|---|
String | ak | true | 开发者密钥 |
String | sn | false | 若用户所用ak的校验方式为sn校验时该参数必须。 (sn生成算法) |
String | origin | true | 起点名称或经纬度 |
String | destination | true | 起点名称或经纬度 |
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,如果失败返回其他数字,详细见状态码附录。 |
results | 路段结果 | |
results.[item] | Item包括如下类型: mainRoad主要路段 entrance道路出入口 landMark途径地标 tollStation收费站 trafficLight红绿灯 serviceArea服务区 gasStation加油站 camera摄像头 other其他 carPark终点停车场 | |
results.[item].name | 路段名称 | 如摄像头 |
results.[item].location | 路段坐标(经纬度) | |
results.[item].location.lng | 经度 | |
results.[item].location.lat | 纬度 | |
results.[item].type | 路段类型 | 其中终点停车场模块carPark没有type类型,其余的参见附表1 |
results.[item].speed | 限速 | 途经路段摄像头点限速,-1为无相关数据 |
results.[item].direction | 方向 | 道路出入口的方向信息 |
results.[item].address | 地址 | 停车场的地址 |
返回xml格式的数据
<ViaPath> <status>success</status> <results> <trafficLight> <result> <name>红绿灯</name> <location> <lng>116.296011</lng> <lat>40.005091</lat> </location> <type>350</type> </result> </trafficLight> </results> </ViaPath>
返回json格式的数据
{ status: "success", results: { trafficLight:[ { name: "红绿灯", location: { lng: 116.296011, lat: 40.005091 }, type: 350 } } }