路径规划接口
接口名称
路径规划接口
接口URL
http://ip:port/navigation/route?points=xx;xx&profile=xx;xx
请求方式
GET
Content-Type
none
请求Query参数
| 参数名 |
示例值 |
参数类型 |
是否必填 |
参数描述 |
| points |
39.926588,116.38916;36.421282,119.11377;39.861008,116.447402 |
String |
是 |
坐标点信息(个数=2:起点-终点,个数>2:起点-途经点-终点) |
| profile |
car_fastest;car_shortest |
String |
是 |
权重信息,代表需要生成哪些权重的路径 |
请求示例
GET http://localhost:8989/navigation/route?points=39.926588,116.38916;36.421282,119.11377;39.861008,116.447402&profile=car_fastest;car_shortest
成功响应示例
{ "code": 0, "desc": "成功", "paths": [ { "policy": "路线1", "distance": 1018146.161, "distanceKm": "1018.146千米", "time": 47797431, "timeStr": "13小时16分钟", "weighting": "car_shortest", "weightingDesc": "交通方式:汽车;权重:距离最短", "points_encoded": false, "points": { "type": "LineString", "coordinates": [ [ 116.389156, 39.92699 ], [ 119.110872, 36.423572 ], [ 116.447402, 39.861008 ] ] }, "instructions": [ { "distance": 892.554, "instruct": "CONTINUE_ON_STREET", "heading": 89.58, "sign": 0, "instructDesc": "继续行驶", "interval": [ 0, 6 ], "text": "继续行驶到 景山后街", "time": 64255, "street_name": "景山后街" }, { "distance": 235.117, "instruct": "TURN_LEFT", "sign": -2, "instructDesc": "左转", "interval": [ 6, 7 ], "text": "左转 到 景山前街", "time": 13020, "street_name": "景山前街" } ], "snapped_waypoints": { "type": "LineString", "coordinates": [ [ 116.389156, 39.92699 ], [ 119.110872, 36.423572 ], [ 116.447402, 39.861008 ] ] } } ]}
响应参数说明
| 参数名 |
示例值 |
参数类型 |
参数描述 |
| code |
0 |
Integer |
响应码 |
| desc |
成功 |
String |
响应描述 |
| paths |
- |
Array |
|
| paths.policy |
路线1 |
String |
当前路线名称 |
| paths.distance |
1018146.161 |
Number |
路径总长度(单位m) |
| paths.distanceKm |
1018.146千米 |
String |
路径总长度(单位km) |
| paths.time |
47797431 |
Integer |
路径总耗时(单位ms) |
| paths.timeStr |
13小时16分钟 |
String |
路径总耗时文字描述 |
| paths.weighting |
car_shortest |
String |
路径权重(该路径使用哪种方式) |
| paths.weightingDesc |
交通方式:汽车;权重:距离最短 |
String |
路径权重描述 |
| paths.points_encoded |
false |
Boolean |
|
| paths.points |
- |
Array |
|
| paths.points.type |
LineString |
String |
GeoJson类型 |
| paths.points.coordinates |
- |
Array |
坐标点经纬度(经度-纬度) |
| paths.instructions |
- |
Array |
|
| paths.instructions.distance |
892.554 |
Number |
路线距离(单位m) |
| paths.instructions.instruct |
CONTINUE_ON_STREET |
String |
路线距离英文描述 |
| paths.instructions.heading |
89.58 |
Number |
路线标题 |
| paths.instructions.sign |
0 |
Integer |
路线标识 |
| paths.instructions.instructDesc |
继续行驶 |
String |
路线动作描述 |
| paths.instructions.interval |
- |
Array |
路线起止点编号 |
| paths.instructions.text |
继续行驶到 景山后街 |
String |
路线动作文本 |
| paths.instructions.time |
64255 |
Integer |
路线耗时(单位ms) |
| paths.instructions.street_name |
景山后街 |
String |
路线街道名称 |
| paths.snapped_waypoints |
- |
Array |
|
| paths.snapped_waypoints.type |
LineString |
String |
GeoJson类型 |
| paths.snapped_waypoints.coordinates |
- |
Array |
参数坐标点经纬度(经度-纬度) |
响应码说明
| 响应编码 |
响应描述 |
| 0 |
成功 |
| 10001 |
未匹配到路径信息 |
| 10002 |
地名无效 |
权重可选值说明
| 可选值 |
说明 |
| car_fastest |
交通方式: 汽车; 权重: 时间最短 |
| car_shortest |
交通方式: 汽车; 权重: 距离最短 |
| foot_fastest |
交通方式: 步行; 权重: 时间最短 |
| foot_shortest |
交通方式: 步行; 权重: 距离最短 |
| bike_fastest |
交通方式: 骑行; 权重: 时间最短 |
| bike_shortest |
交通方式: 骑行; 权重: 距离最短 |
转向动作说明
| 动作 |
描述 |
| CONTINUE_ON_STREET |
继续行驶 |
| TURN_SLIGHT_RIGHT |
偏右转 |
| TURN_SLIGHT_LEFT |
偏左转 |
| TURN_RIGHT |
右转 |
| TURN_LEFT |
左转 |
| TURN_SHARP_RIGHT |
右急转 |
| TURN_SHARP_LEFT |
左急转 |
| FINISH |
到达终点 |
| REACHED_VIA |
保持通过 |
| USE_ROUNDABOUT |
进入环岛 |
| LEAVE_ROUNDABOUT |
离开环岛 |
| KEEP_RIGHT |
保持右行 |
| KEEP_LEFT |
保持左行 |
| U_TURN_RIGHT |
向右掉头 |
| U_TURN_LEFT |
向左掉头 |