1.相关文档地址
下载路网数据
- https://extract.bbbike.org/
- https://www.openstreetmap.org/export#map=13/31.2516/121.4836
https://download.geofabrik.de/
开发文档
- https://www.graphhopper.com/developers/
https://graphhopper.com/dashboard/#/editor
其他文档
OSM中文文档:https://wiki.openstreetmap.org/wiki/Zh-hans:Main_Page
- Graphhopper OSM地图路径规划导航 离线搭建教程:https://blog.csdn.net/haochajin/article/details/99851216
- OpenStreetMap开发文档:https://blog.csdn.net/juemuren444/article/details/54389285
- graphhopper配置文件说明:https://github.com/graphhopper/graphhopper/blob/master/config-example.yml
- graphhopper技术概述:https://github.com/graphhopper/graphhopper/blob/master/docs/core/technical.md
- graphhopper论坛:https://www.it1352.com/tag/graphhopper
- OSM 路网提取道路交点:https://blog.csdn.net/m0_38058163/article/details/91971491
- 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 权重可选值|
请求示例
GET /navigation/route?points=39.926588,116.38916;36.421282,119.11377;39.861008,116.447402&profile=car_fastest;car_shortestContent-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 |
响应示例
{"code": 0,"desc": "成功","paths": [{"policy": "路线1","distance": 378361.535,"distanceKm": "378.362千米","time": 14321639,"timeStr": "3小时58分钟","weighting": "car_fastest","weightingDesc": "交通方式:汽车;权重:时间最短","points": {"coordinates": [[121.629538,25.018242],[121.629861,25.018173],[121.629896,25.017944]]}},{"policy": "路线2","distance": 378361.535,"distanceKm": "378.362千米","time": 14321639,"timeStr": "3小时58分钟","weighting": "car_shortest","weightingDesc": "交通方式:汽车;权重:距离最短","points": {"coordinates": [[121.629538,25.018242],[121.629861,25.018173],[121.629896,25.017944]]}}]}
附录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 | 向左掉头 |
