(→接口示例) |
|||
第6行: | 第6行: | ||
==接口示例== | ==接口示例== | ||
− | http://api.map.baidu.com/telematics/v3/viaPath?origin=116.290993,40.004519&destination=116.38342,39.913348&output=json&ak= | + | http://api.map.baidu.com/telematics/v3/viaPath?origin=116.290993,40.004519&destination=116.38342,39.913348&output=json&ak=E4805d16520de693a3fe707cdc962045 |
==接口参数说明== | ==接口参数说明== |
2015年5月14日 (四) 11:28的版本
接口说明
根据起终点,返回途经路段的信息,包括主要路段、红绿灯、摄像头等
接口示例
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 } } }