1.相关文档地址

下载路网数据

  1. https://extract.bbbike.org/
  2. https://www.openstreetmap.org/export#map=13/31.2516/121.4836
  3. https://download.geofabrik.de/

    开发文档

  4. https://docs.graphhopper.com/

  5. https://www.graphhopper.com/developers/
  6. https://graphhopper.com/dashboard/#/editor

    其他文档

  7. OSM中文文档:https://wiki.openstreetmap.org/wiki/Zh-hans:Main_Page

  8. Graphhopper OSM地图路径规划导航 离线搭建教程:https://blog.csdn.net/haochajin/article/details/99851216
  9. OpenStreetMap开发文档:https://blog.csdn.net/juemuren444/article/details/54389285
  10. graphhopper配置文件说明:https://github.com/graphhopper/graphhopper/blob/master/config-example.yml
  11. graphhopper技术概述:https://github.com/graphhopper/graphhopper/blob/master/docs/core/technical.md
  12. graphhopper论坛:https://www.it1352.com/tag/graphhopper
  13. OSM 路网提取道路交点:https://blog.csdn.net/m0_38058163/article/details/91971491
  14. Graphhopper Routing导航API请求参数和返回结果说明:https://blog.csdn.net/haochajin/article/details/99963678

    2.相关接口文档

    路径规划能力接口

    请求参数

    | 字段 | 描述 | 数据类型 | 长度 | 必填 | 说明 | | —- | —- | —- | —- | —- | —- | | points | 节点(坐标) | List<String
    > | 64 | 是 | 经纬度参数
    1.每组参数用英文分号连接,可传入多组
    2.解读机制为起点;途经点1;途经点2;...;终点
    3.若只传入2组,则视为不设置途经点
    4.每组参数格式纬度,经度
    5.示例39.926588,116.38916 | | profile | 权重(优先级) | String | 64 | 否 | 权重参数
    每组参数用英文分号连接,可传入多组
    可选值参见附录1 权重可选值 |

请求示例

  1. GET /navigation/route?points=39.926588,116.38916;36.421282,119.11377;39.861008,116.447402&profile=car_fastest;car_shortest
  2. Content-Type: application/json;charset=utf-8

响应参数

字段 描述 父节点 数据类型 长度 必填 说明
code 响应码 - int 32 -
desc 响应描述 - String 32 -
paths 路径信息 - List<obj
>
32 -
policy 路线方案编号 paths String 32 路线方案编号
distance 路径长度 paths double 32 单位:
distanceKm 路径长度 paths double 32 单位:千米
distance
参数进行四舍五入计算得出
time 路径预计用时 paths long 32 单位:毫秒
timeStr 路径预计用时 paths String 32 格式x小时x分钟
time
参数转换得出
weighting 权重 paths String 32 单位:权重
含义及映射关系参见附录1 权重可选值
weightingDesc 权重说明 paths String 32 权重说明
映射关系参见附录1 权重可选值
points 路径节点信息 paths obj 32 -
coordinates 节点坐标 paths List<obj
>
32 格式经度,纬度
格式116.389156,39.92699

响应示例

  1. {
  2. "code": 0,
  3. "desc": "成功",
  4. "paths": [
  5. {
  6. "policy": "路线1",
  7. "distance": 378361.535,
  8. "distanceKm": "378.362千米",
  9. "time": 14321639,
  10. "timeStr": "3小时58分钟",
  11. "weighting": "car_fastest",
  12. "weightingDesc": "交通方式:汽车;权重:时间最短",
  13. "points": {
  14. "coordinates": [
  15. [
  16. 121.629538,
  17. 25.018242
  18. ],
  19. [
  20. 121.629861,
  21. 25.018173
  22. ],
  23. [
  24. 121.629896,
  25. 25.017944
  26. ]
  27. ]
  28. }
  29. },
  30. {
  31. "policy": "路线2",
  32. "distance": 378361.535,
  33. "distanceKm": "378.362千米",
  34. "time": 14321639,
  35. "timeStr": "3小时58分钟",
  36. "weighting": "car_shortest",
  37. "weightingDesc": "交通方式:汽车;权重:距离最短",
  38. "points": {
  39. "coordinates": [
  40. [
  41. 121.629538,
  42. 25.018242
  43. ],
  44. [
  45. 121.629861,
  46. 25.018173
  47. ],
  48. [
  49. 121.629896,
  50. 25.017944
  51. ]
  52. ]
  53. }
  54. }
  55. ]
  56. }

附录1 权重可选值

可选值 说明
car_fastest 交通方式: 汽车; 权重: 时间最短
car_shortest 交通方式: 汽车; 权重: 距离最短
foot_fastest 交通方式: 步行; 权重: 时间最短
foot_shortest 交通方式: 步行; 权重: 距离最短
bike_fastest 交通方式: 骑行; 权重: 时间最短
bike_shortest 交通方式: 骑行; 权重: 距离最短

附录2 转向动作

动作 描述
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 向左掉头