一.OSRM部署
1.安装docker ,mac可以下载docker安装包,
相关安装代码
curl -fsSL https://get.docker.com/ | sh
daocloud.io 国内镜像
curl -sSL https://get.daocloud.io/docker | sh
配置加速器
docker - 偏好设置 - Advanced - Registry mirrors,添加如下地址
镜像:http://1876aa8d.m.daocloud.io
2.下载OpenStreetMap的数据
地址:http://download.geofabrik.de
相关安装代码
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
安装说明,安装wget:sudo brew install wget 安装Homebrew :ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3安装osrm-backend Server 端
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-contract /data/berlin-latest.osrm
运行在5000端口
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend osrm-routed /data/berlin-latest.osrm
请求示例:
http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true
安装web端用于显示地图,运行在 9966 端口:
docker run -p 9966:9966 osrm/osrm-frontend
2.openstreetmap街道数据导出
osm官网通过镜像直接下载shp格式地图数据,然后加载到ArcGIS里面
ArcGIS下载,ArcGIS只能在windows上使用,需要使用windows电脑进行查看具体道路数据格式是什么规格的,然后定义如何匹配
3.路径规划:
接口调用的方式,例如:http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true
接口规范说明:https://wenku.baidu.com/view/c27e6c15cdbff121dd36a32d7375a417876fc15b.html
算法研究,判断一个指定的经纬度点是否落在一个多边形区域内?
http://www.cnblogs.com/relax/p/3507014.html
https://api.mapbox.com/directions/v5/mapbox/driving-traffic/116.38640615804951%2C39.92646723396473%3B116.8284884859687%2C38.305649439016236.json?geometries=polyline&annotations=congestion&steps=true&overview=full&access_token=pk.eyJ1IjoiZGFucGF0IiwiYSI6ImI0WThCVWMifQ.BP_j7Kiv5SNL-p-kTfXNxg