路径规划接口

接口名称

路径规划接口

接口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 权重信息,代表需要生成哪些权重的路径

请求示例

  1. GET http://localhost:8989/navigation/route?points=39.926588,116.38916;36.421282,119.11377;39.861008,116.447402&profile=car_fastest;car_shortest

成功响应示例

  1. {
  2. "code": 0,
  3. "desc": "成功",
  4. "paths": [
  5. {
  6. "policy": "路线1",
  7. "distance": 1018146.161,
  8. "distanceKm": "1018.146千米",
  9. "time": 47797431,
  10. "timeStr": "13小时16分钟",
  11. "weighting": "car_shortest",
  12. "weightingDesc": "交通方式:汽车;权重:距离最短",
  13. "points_encoded": false,
  14. "points": {
  15. "type": "LineString",
  16. "coordinates": [
  17. [
  18. 116.389156,
  19. 39.92699
  20. ],
  21. [
  22. 119.110872,
  23. 36.423572
  24. ],
  25. [
  26. 116.447402,
  27. 39.861008
  28. ]
  29. ]
  30. },
  31. "instructions": [
  32. {
  33. "distance": 892.554,
  34. "instruct": "CONTINUE_ON_STREET",
  35. "heading": 89.58,
  36. "sign": 0,
  37. "instructDesc": "继续行驶",
  38. "interval": [
  39. 0,
  40. 6
  41. ],
  42. "text": "继续行驶到 景山后街",
  43. "time": 64255,
  44. "street_name": "景山后街"
  45. },
  46. {
  47. "distance": 235.117,
  48. "instruct": "TURN_LEFT",
  49. "sign": -2,
  50. "instructDesc": "左转",
  51. "interval": [
  52. 6,
  53. 7
  54. ],
  55. "text": "左转 到 景山前街",
  56. "time": 13020,
  57. "street_name": "景山前街"
  58. }
  59. ],
  60. "snapped_waypoints": {
  61. "type": "LineString",
  62. "coordinates": [
  63. [
  64. 116.389156,
  65. 39.92699
  66. ],
  67. [
  68. 119.110872,
  69. 36.423572
  70. ],
  71. [
  72. 116.447402,
  73. 39.861008
  74. ]
  75. ]
  76. }
  77. }
  78. ]
  79. }

响应参数说明

参数名 示例值 参数类型 参数描述
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 向左掉头