1.从github上下载osmpgrouting源码下来编译安装
osm2pgrouting网址:https://github.com/pgRouting/osm2pgrouting
2. 在编译安装前,需要安装下面这些
我之前配置了一部分环境,只差pgrouting,boost和expat没安装。
(1)安装pgrouting
方法一:
方法二:源码编译,可以参考下面的方法。
网址:https://zhuanlan.zhihu.com/p/82405507
或者:https://github.com/pgRouting/pgrouting
(2)安装boost
参考网址:https://www.cnblogs.com/cnxkey/articles/10257676.html
(2)安装expat
参考网址
下载:https://github.com/libexpat/libexpat/releases
安装:https://blog.csdn.net/name_is_wl/article/details/72792972
3.开始编译安装osmpgrouting
4.用osm2pgrouting将osm地图导入数据库
先在数据库安装postgis插件和pgrouting插件,即用如下查询语句,然后运行即可。
create extension postgis;
create extension pgrouting;
然后把地图导入数据库:
命令行的选项:--f 和--conf,不可以改成-f,-conf,否则会报错:
Error opening onf:No such file or directoryFailed to open / parse config file
onf
若是出现下面这个错误:
osm2pgrouting: error while
loading shared libraries: libboost_program_options.so.1.69.0: cannot open shared object file: No such file or directory
解决办法可以根据这个网址: https://blog.csdn.net/wjx_1999/article/details/100906032