驾车路径规划
GET
https://restapi.amap.com/v3/direction/driving接口简介:
驾车路径规划 API 可以规划以小客车、轿车通勤出行的方案,并且返回通勤方案的数据。
parameters 代表的参数包括必填参数和可选参数。所有参数均使用和号字符(&)进行分隔。下面的列表枚举了这些参数及其使用规则。
- 服务示例
https://restapi.amap.com/v3/direction/driving?origin=116.481028,39.989643&destination=116.465302,40.004717&extensions=all&output=xml&key=<用户的key>
参数 | 值 | 备注 | 必选 |
---|---|---|---|
origin | lon,lat(经度,纬度),如117.500244, 40.417801 经纬度小数点不超过6位 | 是 | |
destination | lon,lat(经度,纬度),如117.500244, 40.417801 经纬度小数点不超过6位 | 是 | |
originid | 当起点为POI时,建议填充此值 | 否 | |
destinationid | 当终点为POI时,建议填充此值 | 否 | |
extensions | base all | base:返回基本信息;all:返回全部信息 | 否 |
strategy | 参见上方strategy的说明 | 否 | |
waypoints | 途经点,最大数目:16个坐标点 | 否 | |
avoidpolygons | 避让区域,如果是四边形则有四个坐标点,如果是五边形则有五个坐标点 | 否 | |
avoidroad | 只支持一条避让道路,如:广顺北大街 | 否 |
- 驾车动作列表
注意:extensions=all时以下信息才会返回
主要动作列表 |
---|
无基本导航动作左转右转向左前方行驶向右前方行驶向左后方行驶向右后方行驶左转调头直行靠左靠右进入环岛离开环岛减速行驶 |
辅助动作列表 |
---|
无辅助导航动作进入主路进入辅路进入高速进入匝道进入隧道进入中间岔道进入右岔路进入左岔路进入右转专用道进入左转专用道进入中间道路进入右侧道路进入左侧道路靠右行驶进入辅路靠左行驶进入辅路靠右行驶进入主路靠左行驶进入主路靠右行驶进入右转专用道进入轮渡驶离轮渡沿当前道路行驶沿辅路行驶沿主路行驶到达出口到达服务区到达收费站到达途经地到达目的地的绕环岛左转绕环岛右转绕环岛直行绕环岛调头小环岛不数出口到达复杂路口,走右边第一出口到达复杂路口,走右边第二出口到达复杂路口,走右边第三出口到达复杂路口,走右边第四出口到达复杂路口,走右边第五出口到达复杂路口,走左边第一出口到达复杂路口,走左边第二出口到达复杂路口,走左边第三出口到达复杂路口,走左边第四出口到达复杂路口,走左边第五出口进入调头专用路 |
请求参数
经度在前,纬度在后,经度和纬度用","分割,经纬度小数点后不得超过6位。格式为x1,y1|x2,y2|x3,y3。 由于在实际使用过程中,存在定位飘点的情况。为了解决此类问题,允许传入多个起点用于计算车头角度。 最多允许传入3个坐标对,每对坐标之间距离必须超过2m。 虽然对每对坐标之间长度没有上限,但是如果超过4米会有概率性出现不准确的情况。使用三个点来判断距离和角度的有效性,如果两者都有效,使用第一个点和最后一个点计算的角度设置抓路的角度,规划路径时以最后一个坐标对进行规划。
经度在前,纬度在后,经度和纬度用","分割,经纬度小数点后不得超过6位。
当起点为POI时,建议填充此值。
当终点为POI时,建议填充此值。
当用户知道起点POI的类别时候,建议填充此值
当用户知道终点POI的类别时候,建议填充此值
下方1020的策略,会返回多条路径规划结果。(高德地图APP策略也包含在内,强烈建议从此策略之中选择) 下方策略 09的策略,仅会返回一条路径规划结果。 下方策略返回多条路径规划结果 10,返回结果会躲避拥堵,路程较短,尽量缩短时间,与高德地图的默认策略也就是不进行任何勾选一致 11,返回三个结果包含:时间最短;距离最短;躲避拥堵 (由于有更优秀的算法,建议用10代替) 12,返回的结果考虑路况,尽量躲避拥堵而规划路径,与高德地图的“躲避拥堵”策略一致 13,返回的结果不走高速,与高德地图“不走高速”策略一致 14,返回的结果尽可能规划收费较低甚至免费的路径,与高德地图“避免收费”策略一致 15,返回的结果考虑路况,尽量躲避拥堵而规划路径,并且不走高速,与高德地图的“躲避拥堵&不走高速”策略一致 16,返回的结果尽量不走高速,并且尽量规划收费较低甚至免费的路径结果,与高德地图的“避免收费&不走高速”策略一致 17,返回路径规划结果会尽量的躲避拥堵,并且规划收费较低甚至免费的路径结果,与高德地图的“躲避拥堵&避免收费”策略一致 18,返回的结果尽量躲避拥堵,规划收费较低甚至免费的路径结果,并且尽量不走高速路,与高德地图的“避免拥堵&避免收费&不走高速”策略一致 19,返回的结果会优先选择高速路,与高德地图的“高速优先”策略一致 20,返回的结果会优先考虑高速路,并且会考虑路况躲避拥堵,与高德地图的“躲避拥堵&高速优先”策略一致 下方策略仅返回一条路径规划结果 0,速度优先,此路线不一定距离最短 1,费用优先,不走收费路段,且耗时最少的路线 2,距离优先,仅走距离最短的路线,但是可能存在穿越小路/小区的情况 3,速度优先,不走快速路,例如京通快速路(因为策略迭代,建议使用13) 4,躲避拥堵,但是可能会存在绕路的情况,耗时可能较长 5,多策略(同时使用速度优先、费用优先、距离优先三个策略计算路径)。 其中必须说明,就算使用三个策略算路,会根据路况不固定的返回一~三条路径规划信息。 6,速度优先,不走高速,但是不排除走其余收费路段 7,费用优先,不走高速且避免所有收费路段 8,躲避拥堵和收费,可能存在走高速的情况,并且考虑路况不走拥堵路线,但有可能存在绕路和时间较长 9,躲避拥堵和收费,不走高速
经度和纬度用","分割,经度在前,纬度在后,小数点后不超过6位,坐标点之间用";"分隔 最大数目:16个坐标点。如果输入多个途径点,则按照用户输入的顺序进行路径规划
区域避让,支持32个避让区域,每个区域最多可有16个顶点 经度和纬度用","分割,经度在前,纬度在后,小数点后不超过6位,坐标点之间用";"分隔,区域之间用"|"分隔。如果是四边形则有四个坐标点,如果是五边形则有五个坐标点; 同时传入避让区域及避让道路,仅支持避让道路; 避让区域不能超过81平方公里,否则避让区域会失效。
例如:京(用汉字填入车牌省份缩写,用于判断是否限行)
例如:NH1N11 支持6位传统车牌和7位新能源车牌
0:普通汽车(默认值) 1:纯电动车 2:插电混动车
0:使用渡轮(默认) 1:不使用渡轮
false:不返回路径聚合信息 true:返回路径聚合信息,在steps上层增加roads做聚合
当取值为0时,steps字段内容正常返回; 当取值为1时,steps字段内容为空;
数字签名认证用户必填
可选值:JSON,XML
callback值是用户定义的函数名称,此参数只在output=JSON时有效
可选值:base/all base:返回基本信息;all:返回全部信息
示例代码
返回响应
0:请求失败;1:请求成功
status为0时,info返回错误原因,否则返回“OK”。详情参阅info状态表
规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位
规则: lon,lat(经度,纬度), “,”分割,如117.500244, 40.417801 经纬度小数点不超过6位
{
"status": "1",
"info": "OK",
"infocode": "10000",
"count": "1",
"route": {
"origin": "116.481028,39.989643",
"destination": "116.434446,39.90816",
"paths": [
{
"distance": "27558",
"duration": "2644",
"strategy": "速度最快",
"tolls": "0",
"toll_distance": "0",
"steps": [
{
"instruction": "向北行驶109米右转",
"orientation": "北",
"distance": "109",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "44",
"polyline": "116.480891,39.98937;116.480553,39.989606;116.480548,39.98966;116.480596,39.989708;116.481095,39.990051",
"action": "右转",
"assistant_action": []
},
{
"instruction": "向东南行驶36米右转",
"orientation": "东南",
"distance": "36",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "18",
"polyline": "116.481095,39.990051;116.481111,39.990003;116.481347,39.989794",
"action": "右转",
"assistant_action": []
},
{
"instruction": "向西南行驶76米右转进入主路",
"orientation": "西南",
"distance": "76",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "40",
"polyline": "116.481347,39.989794;116.481374,39.989756;116.481368,39.989719;116.480939,39.989284;116.480886,39.989225",
"action": "右转",
"assistant_action": "进入主路"
},
{
"instruction": "沿阜荣街向西北行驶110米右转",
"orientation": "西北",
"road": "阜荣街",
"distance": "110",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "46",
"polyline": "116.480816,39.989156;116.480065,39.98966;116.47984,39.98981",
"action": "右转",
"assistant_action": []
},
{
"instruction": "沿阜通东大街向东北行驶371米右转",
"orientation": "东北",
"road": "阜通东大街",
"distance": "371",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "46",
"polyline": "116.479899,39.989869;116.479947,39.989912;116.480033,39.989992;116.480301,39.990234;116.480344,39.990271;116.480553,39.990459;116.481122,39.99098;116.481229,39.991076;116.4819,39.991693;116.482715,39.992449",
"action": "右转",
"assistant_action": []
},
{
"instruction": "沿望京街向东南行驶576米左转",
"orientation": "东南",
"road": "望京街",
"distance": "576",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "188",
"polyline": "116.482715,39.992449;116.483139,39.992186;116.483745,39.991773;116.484582,39.99121;116.484963,39.990974;116.485108,39.990872;116.485215,39.990808;116.48573,39.99047;116.486084,39.990234;116.486357,39.990051;116.486556,39.989917;116.487849,39.989075",
"action": "左转",
"assistant_action": []
},
{
"instruction": "沿京密路向东北行驶377米向右前方行驶进入匝道",
"orientation": "东北",
"road": "京密路",
"distance": "377",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "35",
"polyline": "116.488063,39.989054;116.488305,39.989279;116.489361,39.990234;116.490928,39.991645",
"action": "向右前方行驶",
"assistant_action": "进入匝道"
},
{
"instruction": "沿S12机场高速入口途径S12机场高速向西南行驶7.0千米向右前方行驶进入匝道",
"orientation": "西南",
"road": "S12机场高速入口",
"distance": "6990",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "311",
"polyline": "116.490928,39.991645;116.491089,39.99172;116.491159,39.991741;116.491276,39.991752;116.491352,39.991736;116.491411,39.991693;116.491438,39.991661;116.491464,39.991628;116.491486,39.991586;116.491496,39.99151;116.491486,39.991333;116.490273,39.990234;116.49007,39.990051;116.487961,39.988152;116.487425,39.98767;116.485537,39.985953;116.484453,39.984966;116.481411,39.982203;116.479518,39.980503;116.479126,39.980149;116.478123,39.979247;116.47705,39.978282;116.476659,39.977928;116.474588,39.976061;116.472635,39.97428;116.470409,39.972279;116.470146,39.972048;116.468853,39.970874;116.468483,39.970546;116.466911,39.969136;116.465935,39.968261;116.465705,39.968052;116.46173,39.964511;116.46056,39.963433;116.458361,39.961475;116.45702,39.960252;116.456102,39.959426;116.455078,39.958503;116.454788,39.95824;116.453972,39.9575;116.453726,39.957275;116.453463,39.957033;116.451778,39.95551;116.449735,39.953643;116.449,39.952967;116.447921,39.951991;116.446489,39.950693;116.446028,39.950323;116.445781,39.950178;116.445534,39.950054;116.445126,39.949899;116.44496,39.94984;116.444676,39.949775;116.444258,39.949711;116.443973,39.949684;116.443292,39.949673;116.442246,39.949663;116.439762,39.949646;116.439644,39.949646;116.439269,39.949641;116.436796,39.949636;116.435358,39.949598",
"action": "向右前方行驶",
"assistant_action": "进入匝道"
},
{
"instruction": "沿东直门北桥向西南行驶808米靠左进入主路",
"orientation": "西南",
"road": "东直门北桥",
"distance": "808",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "59",
"polyline": "116.435358,39.949598;116.434988,39.949663;116.434736,39.949738;116.4345,39.949824;116.43428,39.949958;116.434119,39.950065;116.433872,39.950215;116.433711,39.950285;116.433647,39.950312;116.433475,39.950344;116.433325,39.950355;116.433201,39.950344;116.433105,39.950317;116.433083,39.950312;116.433003,39.950274;116.432847,39.950178;116.432713,39.950049;116.432617,39.949904;116.432563,39.949797;116.432536,39.9497;116.43252,39.949604;116.43252,39.949513;116.432531,39.949405;116.432568,39.949255;116.432622,39.949131;116.432692,39.94903;116.43281,39.94889;116.432955,39.948756;116.433105,39.948585;116.43326,39.94837;116.433373,39.948128;116.433421,39.947973;116.433491,39.947705;116.433539,39.947458;116.433566,39.947184;116.433571,39.946932;116.43355,39.946288;116.433523,39.945328",
"action": "靠左",
"assistant_action": "进入主路"
},
{
"instruction": "沿东直门北桥途径东二环向南行驶3.8千米向右前方行驶进入匝道",
"orientation": "南",
"road": "东直门北桥",
"distance": "3801",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "219",
"polyline": "116.433523,39.945328;116.433657,39.944641;116.433636,39.944078;116.433631,39.94373;116.433824,39.938188;116.433861,39.937453;116.43392,39.936257;116.433936,39.935742;116.433958,39.935302;116.43414,39.931445;116.434151,39.93107;116.434172,39.9307;116.434183,39.930292;116.434221,39.929535;116.434242,39.928795;116.434269,39.928301;116.434328,39.926918;116.434441,39.924316;116.434526,39.922342;116.434559,39.921655;116.43458,39.921135;116.43472,39.91798;116.434736,39.917573;116.434805,39.915969;116.43488,39.914467;116.43494,39.913871;116.434998,39.913506;116.435036,39.91333;116.435095,39.913051;116.435326,39.912058;116.435513,39.911253;116.43554,39.911055",
"action": "向右前方行驶",
"assistant_action": "进入匝道"
},
{
"instruction": "沿建国门桥途径建国门内大街、东长安街、西长安街、复兴门内大街向西行驶6.9千米到达途经地",
"orientation": "西",
"road": "建国门桥",
"distance": "6879",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "754",
"polyline": "116.43554,39.911055;116.435471,39.910701;116.435379,39.910508;116.435202,39.910213;116.435133,39.910068;116.43509,39.909928;116.435063,39.909773;116.435058,39.909585;116.43509,39.908845;116.435063,39.90877;116.435036,39.908732;116.434896,39.908646;116.433502,39.90863;116.433105,39.908625;116.432188,39.908614;116.431453,39.908582;116.430841,39.908582;116.430514,39.908571;116.429446,39.908566;116.429376,39.908566;116.427134,39.908528;116.426973,39.908528;116.425176,39.908485;116.424415,39.908475;116.423428,39.908453;116.423358,39.908453;116.422896,39.908448;116.422349,39.908437;116.421212,39.908405;116.420836,39.9084;116.418111,39.908346;116.417902,39.908335;116.415649,39.908265;116.41449,39.908233;116.413385,39.908201;116.411481,39.908147;116.411336,39.908142;116.411132,39.908137;116.4094,39.908078;116.409271,39.908072;116.408708,39.908051;116.408273,39.90803;116.408069,39.908024;116.407511,39.908013;116.406744,39.908003;116.406615,39.908003;116.40491,39.907949;116.403204,39.907895;116.402587,39.907868;116.401734,39.907836;116.399352,39.907756;116.395726,39.907633;116.395586,39.907627;116.394465,39.9076;116.392958,39.907541;116.391783,39.907509;116.389803,39.907413;116.389653,39.907407;116.38916,39.907391;116.388226,39.907359;116.386574,39.907321;116.384133,39.907251;116.382813,39.907225;116.381628,39.907235;116.381226,39.907225;116.380711,39.90723;116.380051,39.907257;116.379268,39.907262;116.377819,39.907262;116.376628,39.907268;116.375872,39.907257;116.374177,39.907262;116.374016,39.907262;116.371865,39.907268;116.370068,39.907268;116.36775,39.907262;116.367187,39.907262;116.36657,39.907262;116.36583,39.907268;116.364633,39.907268;116.363335,39.907273;116.363196,39.907273;116.363083,39.907273;116.361806,39.907278;116.361061,39.907284;116.360406,39.907278;116.359237,39.907295;116.358556,39.907295;116.358207,39.9073;116.357483,39.907304",
"action": [],
"assistant_action": "到达途经地"
},
{
"instruction": "沿复兴门内大街向西行驶118米右转进入匝道",
"orientation": "西",
"road": "复兴门内大街",
"distance": "118",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "20",
"polyline": "116.357483,39.907304;116.357215,39.907305;116.357139,39.907305;116.356093,39.907295",
"action": "右转",
"assistant_action": "进入匝道"
},
{
"instruction": "沿复兴门桥向南行驶484米右转",
"orientation": "南",
"road": "复兴门桥",
"distance": "484",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "73",
"polyline": "116.356093,39.907295;116.355938,39.907434;116.355906,39.907488;116.355895,39.907525;116.355879,39.907665;116.355846,39.908383;116.355852,39.90848;116.355857,39.908507;116.355895,39.90856;116.355948,39.908609;116.355997,39.908625;116.356034,39.908636;116.356093,39.908636;116.356125,39.908625;116.356195,39.908598;116.356238,39.908555;116.35626,39.908518;116.356286,39.908426;116.356351,39.906962;116.356378,39.906146;116.356372,39.906039;116.356361,39.905996;116.356329,39.905959;116.356281,39.905926;116.356211,39.9059",
"action": "右转",
"assistant_action": []
},
{
"instruction": "沿复兴门桥途径复兴门内大街、西长安街、东长安街、建国门内大街向东行驶6.6千米向右前方行驶进入辅路",
"orientation": "东",
"road": "复兴门桥",
"distance": "6636",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "748",
"polyline": "116.356211,39.9059;116.356115,39.905905;116.356045,39.905926;116.356007,39.905953;116.355954,39.906018;116.355938,39.906071;116.355932,39.906136;116.355911,39.906871;116.355938,39.906967;116.355959,39.906994;116.355991,39.907021;116.356168,39.907118;116.357134,39.907134;116.357215,39.907134;116.358861,39.907112;116.359237,39.907112;116.360336,39.907101;116.361125,39.907101;116.361806,39.907101;116.36319,39.907101;116.363346,39.907096;116.363566,39.907096;116.365497,39.907101;116.366119,39.907107;116.366661,39.907101;116.367187,39.907101;116.367723,39.907101;116.367981,39.907101;116.368517,39.907096;116.369102,39.907096;116.36981,39.907091;116.370035,39.907091;116.371935,39.90708;116.374016,39.907064;116.374182,39.907064;116.376028,39.907058;116.376505,39.907058;116.378125,39.907064;116.380045,39.907053;116.381226,39.907064;116.381585,39.907069;116.382819,39.907064;116.383833,39.907085;116.387518,39.907182;116.388237,39.907203;116.38916,39.907235;116.389336,39.907241;116.39049,39.907262;116.391654,39.907289;116.391793,39.9073;116.392883,39.907327;116.394406,39.907375;116.395591,39.907407;116.395742,39.907418;116.399368,39.907541;116.400468,39.9076;116.401562,39.907659;116.403139,39.90774;116.40499,39.907804;116.406519,39.907852;116.406808,39.907858;116.40749,39.907874;116.408075,39.907895;116.4083,39.907901;116.408504,39.907906;116.408718,39.907911;116.409276,39.907928;116.409421,39.907933;116.410408,39.907965;116.411132,39.907992;116.411427,39.908003;116.412645,39.908024;116.413385,39.908046;116.414517,39.908072;116.415649,39.908099;116.416041,39.90811;116.417913,39.908174;116.418127,39.908185;116.419528,39.908217;116.420853,39.908244;116.421201,39.908249;116.422355,39.908265;116.422929,39.908276;116.423347,39.908281;116.423454,39.908287;116.424447,39.908287;116.424527,39.908287;116.425192,39.908303;116.426104,39.908325;116.426979,39.908341;116.42714,39.908346;116.42898,39.908373;116.429081,39.908373;116.429387,39.908383;116.429468,39.908389;116.430213,39.908405;116.431147,39.908421;116.432252,39.908443",
"action": "向右前方行驶",
"assistant_action": "进入辅路"
},
{
"instruction": "沿建国门内大街辅路向东行驶187米到达目的地",
"orientation": "东",
"road": "建国门内大街辅路",
"distance": "187",
"tolls": "0",
"toll_distance": "0",
"toll_road": [],
"duration": "43",
"polyline": "116.432252,39.908443;116.432643,39.908373;116.433073,39.908357;116.433105,39.908357;116.434435,39.90839",
"action": [],
"assistant_action": "到达目的地"
}
],
"restriction": "0",
"traffic_lights": "28"
}
]
}
}