所有文档
开发者可通过此功能获取货车路线规划高级字段信息,如道路电子眼、道路设施、交通事件、道路限行、道路禁行等8个高级字段详细信息
高级字段为货车路线规划高级付费服务,需要开通高级权限,您也可以查看您可使用的服务。
如果您已开通了该服务,运行返回结果中将返回路线中高级字段的详细信息。
https://api.map.baidu.com/logistics_direction/v1/truck?origin=22.673186,114.065699&destination=22.6721,114.068886&height=1.8&width=1.9&weight=2.5&length=4.2&axle_weight=2&axle_count=2&is_trailer=0&plate_province=&plate_number=&plate_color=0&ak=你的AK
//GET请求
参数名称 | 必填 | 字段类型 | 含义 | 备注 |
---|---|---|---|---|
show_step_data_flags | 否 | string | 返回结果控制 | 1:电子眼信息 |
字段名称 | 字段类型 | 字段含义 | ||||||
---|---|---|---|---|---|---|---|---|
status | int32 | 取值范围: 0:成功 1:服务内部错误 2:参数错误 更多状态码详见附录 | ||||||
message | string | 状态码对应的信息 | ||||||
result | kv | 返回的结果 | ||||||
routes | array | 返回的方案集 | ||||||
toll | int32 | 此路线道路收费,单位:元。 | ||||||
toll_distance | double | 收费路段里程,单位:米。 | ||||||
steps | array | 路线分段 | ||||||
toll_gate_name | string | 收费站名称 | ||||||
toll_gate_location | ||||||||
lng | double | 收费站位置:经度。 | ||||||
lat | double | 收费站位置:纬度。 | ||||||
camera | array | 电子眼信息;show_step_data_flags参数设置1时该字段返回相应数据 | ||||||
camera_type | int32 | 摄像头类型(详见附表) | ||||||
speed | int32 | 限速摄像头限速值(公里/小时) | ||||||
camera_pt | array | 摄像头坐标 | ||||||
lng | double | 摄像头经度 | ||||||
lat | double | 摄像头纬度 | ||||||
lsr | array | 区间成对标志 | ||||||
lsr_id | int32 | 区间测速的lsr ID | ||||||
distance | int32 | 区间测速距离 | ||||||
speedlimit | int32 | 区间测速 速度限制 | ||||||
lane | array | 车道信息;show_step_data_flags参数设置2时该字段返回相应数据 | ||||||
lane_num | int32 | 车道数 | ||||||
shape_idx_start | int32 | 形状点起始索引 | ||||||
shape_idx_end | int32 | 形状点终止索引 | ||||||
trafficsign | array | 道路设施信息;show_step_data_flags参数设置4时该字段返回相应数据 | ||||||
shape_idx | int32 | 在link中的形状点索引 | ||||||
trafficsign_type | int32 | 类型(详见附表) | ||||||
offset | int32 | 偏移(是在shape_idx对应的坐标点的基础上增加的偏移量) | ||||||
road_attr | array | 道路属性;show_step_data_flags参数设置10时该字段返回相应数据 | ||||||
attr | int32 | 道路属性:0-非匝道,1-匝道 | ||||||
distance | int32 | 长度 | ||||||
shape_idx_start | int32 | 形状点起始索引 | ||||||
shape_idx_end | int32 | 形状点终止索引 | ||||||
name | string | 道路名称 | ||||||
level | int32 | 道路等级 | ||||||
unavoid_roads | array | 交通事件;show_step_data_flags参数设置5时该字段返回相应数据 | ||||||
type | int32 | 事件类型(详见附表) | ||||||
info | string | 解释性信息 | ||||||
title | string | 事件描述 | ||||||
location | array | 地点坐标 | ||||||
lng | double | 地点的经度 | ||||||
lat | double | 地点的纬度 | ||||||
road_info | string | 道路信息描述 | ||||||
unavoid_statistics | array | 交通事件汇总;show_step_data_flags参数设置5时该字段返回相应数据 | ||||||
height | int32 | 限高个数 | ||||||
width | int32 | 限宽个数 | ||||||
weight | int32 | 限重个数 | ||||||
plate | int32 | 货车标牌个数 | ||||||
road_to_open | int32 | 即将开通道路数 | ||||||
unavoid_statistics | int32 | 阻断道路数 | ||||||
limitation_infos | array | 限行信息;show_step_data_flags参数设置6时该字段返回相应数据 | ||||||
info_id | string | 限行id | ||||||
province | string | 省 | ||||||
city | string | 市 | ||||||
county | string | 村 | ||||||
title | string | 标题 | ||||||
limit_type | string | 限行类型 | ||||||
limit_rule | string | 限行规则 | ||||||
geom | string | 限行区域wkt数据 | ||||||
forbidden | array | 禁行信息;show_step_data_flags参数设置7时该字段返回相应数据 | ||||||
vehicle_type | string | 禁行车型 | ||||||
time_do_desc | string | 禁行时间文字描述 | ||||||
limit_region | string | 禁行区域文字描述 |
输入AK可生成包含IP/SN校验方式的代码
<?php// 此处填写你在控制台-应用管理-创建应用后获取的AK$ak = '您的AK';// 发起一个http get请求,并返回请求的结果// $url字段为请求的地址// $param字段为请求的参数function request_get($url = '', $param = array()) {if (empty($url) || empty($param)) {return false;}$getUrl = $url . "?" . http_build_query($param);$curl = curl_init(); // 初始化curlcurl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header$data = curl_exec($curl); // 运行curlif (!$data) {print("an error occured in function request_get(): " . curl_error($curl) . "\n");}curl_close($curl);return $data;}// 请求地址$url = 'https://api.map.baidu.com/logistics_direction/v1/truck';// 构造请求参数$param['origin'] = '22.673186,114.065699';$param['destination'] = '22.6721,114.068886';$param['height'] = '1.8';$param['width'] = '1.9';$param['weight'] = '2.5';$param['length'] = '4.2';$param['axle_weight'] = '2';$param['axle_count'] = '2';$param['is_trailer'] = '0';$param['plate_province'] = '';$param['plate_number'] = '';$param['plate_color'] = '0';$param['ak'] = $ak;$res = request_get($url, $param);// 将原始返回的结果打印出来print("请求的原始返回结果为:\n");print($res . "\n");?>
{"status": 0,"message": "ok","result": {"restriction": {"type": "0","info": ""},"total": 1,"routes": [{"origin": {"lng": 114.06571601088974,"lat": 22.67317578337568},"destination": {"lng": 114.06883474382559,"lat": 22.672117710702736},"tag": "默认","distance": 880,"duration": 450,"steps": [{"leg_index": 0,"direction": 7,"distance": 268,"road_name": "清祥路","road_type": 4,"start_location": {"lng": 114.06571601088974,"lat": 22.67317578337568},"end_location": {"lng": 114.06498411443144,"lat": 22.67095626741058},"path": "114.065716,22.6731758;114.065506,22.6726359;114.065435,22.6724659;114.065385,22.672326;114.065235,22.6718961;114.065225,22.6718661;114.065175,22.6717461;114.065034,22.6713463;114.064934,22.6711064;114.064894,22.6709864;114.064984,22.6709563","traffic_condition": [{"status": 1,"geo_cnt": 8,"distance": 245},{"status": 2,"geo_cnt": 2,"distance": 23}],"restrictions": [{}],"duration": 279,"adcodes": "440309,440307"},{"leg_index": 0,"direction": 4,"distance": 187,"road_name": "环城路","road_type": 3,"start_location": {"lng": 114.06498411443144,"lat": 22.67095626741058},"end_location": {"lng": 114.06647375599361,"lat": 22.67014499432073},"path": "114.064984,22.6709563;114.065264,22.6708159;114.065964,22.6704152;114.066284,22.670165;114.066414,22.670075;114.066474,22.670145","traffic_condition": [{"status": 2,"geo_cnt": 5,"distance": 187}],"restrictions": [{}],"duration": 104,"adcodes": "440307"},{"leg_index": 0,"direction": 1,"distance": 268,"road_name": "五和大道","road_type": 3,"start_location": {"lng": 114.06647375599361,"lat": 22.67014499432073},"end_location": {"lng": 114.06812492008547,"lat": 22.672016417426942},"path": "114.066474,22.670145;114.066664,22.670365;114.067394,22.6712055;114.068095,22.6719964;114.068125,22.6720164","traffic_condition": [{"status": 1,"geo_cnt": 4,"distance": 268}],"restrictions": [{}],"duration": 36,"adcodes": "440307"},{"leg_index": 0,"direction": 4,"distance": 112,"road_name": "","road_type": 6,"start_location": {"lng": 114.06812492008547,"lat": 22.672016417426942},"end_location": {"lng": 114.06910443577772,"lat": 22.671878283021133},"path": "114.068125,22.6720164;114.068215,22.6719865;114.068974,22.671758;114.069104,22.6718783","traffic_condition": [{"status": 0,"geo_cnt": 3,"distance": 112}],"restrictions": [{}],"duration": 16,"adcodes": "440307"},{"leg_index": 0,"direction": 11,"distance": 45,"road_name": "","road_type": 6,"start_location": {"lng": 114.06910443577772,"lat": 22.671878283021133},"end_location": {"lng": 114.06883474382559,"lat": 22.672117710702736},"path": "114.069104,22.6718783;114.068875,22.6720178;114.068815,22.6720877;114.068835,22.6721177","traffic_condition": [{"status": 0,"geo_cnt": 3,"distance": 45}],"restrictions": [{}],"duration": 6,"adcodes": "440307"}],"oil_cost": 0.46,"track_idx": -1,"unavoid_polygons_idx": "","traffic_light_num": 2}],"routesinfo_ext": "eyJzZXNzaW9uX2lkIjoiIiwibG9jIjoibmoiLCJ0cmFja3B0c19kaXN0YW5jZXMiOls4ODBdfQ"}}
参数 | 值 | 备注 | 必选 |
---|---|---|---|
origin | 22.673186,114.065699 | 是 | |
destination | 22.6721,114.068886 | 是 | |
height | 1.8 | 否 | |
width | 1.9 | 否 | |
weight | 2.5 | 否 | |
length | 4.2 | 否 |
电子眼类型:
camera_type | 含义 |
---|---|
0 | 无效 |
1 | 限速 |
2 | 交通信号灯(闯红灯拍照) |
3 | 违章拍照 |
5 | 区间测速摄像头进入 |
6 | 非机动车 |
8 | 公交专用道 |
9 | 区间测速摄像头脱出 |
17 | 应急车道 |
道路设施类型:
trafficsign_type | 含义 |
---|---|
0 | 急转弯 |
1 | 陡坡/下坡 |
2 | 道路变窄 |
3 | 注意路面情况 |
4 | 事故多发地 |
5 | 绕行 |
6 | 禁止超车 |
7 | 解除禁止超车 |
8 | 鸣笛 |
9 | 注意汇流 |
10 | 让行 |
11 | 隧道开灯 |
交通事件类型:
type | 含义 | 备注 |
---|---|---|
4312 | 货车限高 | 物理限制 |
4313 | 货车限宽 | 物理限制 |
4314 | 货车限重 | 物理限制 |
4315 | 禁止通行 | 交通标牌 |
5010 | 禁止通行 | 疑似阻断 |
103 | 交通管制 | 阻断 |
110 | 道路施工 | 阻断 |
111 | 预上线 | 预上线 |
112 | 交通阻断 | 阻断 |
上一篇
下一篇
本篇文章对您是否有帮助?