货车路线规划 | 百度地图api sdk-凯发k8官方旗舰厅

浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。
危化品路线规划及导航
下载开发文档
接口说明

开发者可以通过该功能,获取危化品路线规划及导航。

使用说明

危化品路线规划及导航为高级付费服务,需要开通高级权限,您也可以查看您可使用的服务

如果您已开通了该服务,运行返回结果中将返回危化品路线规划及导航

请求参数
参数名称参数含义示例字段类型必选
vehicle_usages是如果设置该字段,会根据货车用途进行限行规避

0,17
0-默认;17-危险物品
注意:该功能为高级付费功能,需通过联系工作人员开通

string
如您需要获取危化品路线及导航,请点击。
示例代码
填写您的ak

输入ak可生成包含ip/sn校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的ak
$ak ='您的ak';
// 发起一个http get请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
functionrequest_get($url ='', $param =array()){
if(empty($url)||empty($param)){
returnfalse;
}
$geturl = $url ."?".http_build_query($param);
$curl =curl_init();// 初始化curl
curl_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);// 运行curl
if(!$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['vehicle_usages']='17';
$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":365,
"toll":0,
"toll_distance":0,
"steps":[
{
"leg_index":0,
"direction":7,
"distance":216,
"road_name":"清祥路",
"road_type":4,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"start_location":{
"lng":114.06571601088974,
"lat":22.67317578337568
},
"end_location":{
"lng":114.06503442048037,
"lat":22.671346252553548
},
"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",
"traffic_condition":[
{
"status":1,
"geo_cnt":7,
"distance":216
}
],
"restrictions":[
{}
],
"duration":85,
"adcodes":"440309",
"turn":1,
"instructions":"请直行,进入清祥路",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
},
{
"leg_index":0,
"direction":7,
"distance":52,
"road_name":"清祥路",
"road_type":4,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"start_location":{
"lng":114.06503442048037,
"lat":22.671346252553548
},
"end_location":{
"lng":114.06498411443144,
"lat":22.67095626741058
},
"path":"114.065034,22.6713463;114.064934,22.6711064;114.064894,22.6709864;114.064984,22.6709563",
"traffic_condition":[
{
"status":1,
"geo_cnt":3,
"distance":52
}
],
"restrictions":[
{}
],
"duration":25,
"adcodes":"440309,440307",
"turn":35,
"instructions":"靠左前方直行,沿清祥路继续行驶",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
},
{
"leg_index":0,
"direction":4,
"distance":118,
"road_name":"环城路",
"road_type":3,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"start_location":{
"lng":114.06498411443144,
"lat":22.67095626741058
},
"end_location":{
"lng":114.06596391717336,
"lat":22.670415194262233
},
"path":"114.064984,22.6709563;114.065264,22.6708159;114.065964,22.6704152",
"traffic_condition":[
{
"status":1,
"geo_cnt":2,
"distance":118
}
],
"restrictions":[
{}
],
"duration":121,
"adcodes":"440307",
"turn":7,
"instructions":"左转,进入环城路",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
},
{
"leg_index":0,
"direction":4,
"distance":69,
"road_name":"环城路",
"road_type":3,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"start_location":{
"lng":114.06596391717336,
"lat":22.670415194262233
},
"end_location":{
"lng":114.06647375599361,
"lat":22.67014499432073
},
"path":"114.065964,22.6704152;114.066284,22.670165;114.066414,22.670075;114.066474,22.670145",
"traffic_condition":[
{
"status":1,
"geo_cnt":3,
"distance":69
}
],
"restrictions":[
{}
],
"duration":48,
"adcodes":"440307",
"turn":35,
"instructions":"靠左前方直行,沿环城路继续行驶",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
},
{
"leg_index":0,
"direction":1,
"distance":268,
"road_name":"五和大道",
"road_type":3,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"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":44,
"adcodes":"440307",
"turn":7,
"instructions":"左转,进入五和大道",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
},
{
"leg_index":0,
"direction":4,
"distance":112,
"road_name":"",
"road_type":6,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"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":23,
"adcodes":"440307",
"turn":3,
"instructions":"右转",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
},
{
"leg_index":0,
"direction":11,
"distance":45,
"road_name":"",
"road_type":6,
"toll_distance":0,
"toll_gate_location":{
"lng":0,
"lat":0
},
"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":8,
"adcodes":"440307",
"turn":7,
"instructions":"左转",
"camera":[
{}
],
"lane":[
{}
],
"trafficsign":[
{}
],
"road_attr":[
{}
],
"intersections":[
{}
]
}
],
"oil_cost":0.46,
"track_idx":-1,
"unavoid_polygons_idx":"",
"unavoid_statistics":{
"height":0,
"width":0,
"weight":0,
"plate":0,
"road_to_open":0,
"road_not_open":0
},
"traffic_light_num":2,
"route_id":"imcioii2m18xiiwibyi6ijexnda1ote0ldiynjy3ntmilcj3ijoiqufbqsisimxhymvsijoiocisinnlcsi6ijai"
}
],
"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
vehicle_usages
17

上一篇

货车etc费用

下一篇

更新日志

本篇文章对您是否有帮助?

网站地图