ubuntu使用postgist,pgrouting
安装过程
一 :所需组件
1 PostgreSQL 9.4 or higher.
2 Proj4 .reprojection library.
3 GEOS .geometry library.
4 LibXML2. LibXML2 is currently used in some imports functions
5 JSON-C. JSON-C is currently used to import GeoJSON via the function ST_GeomFromGeoJson.
6 GDAL.
以上所需组件最好下载源码安装。
二: 环境信息
Postgresql: 9.4.2
Postgis: 2.2
pgrouting: 2.2
OS : Ubuntu 15.04
查看方法:
routedb_test=# select postgis_version();
postgis_version
---------------------------------------
2.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)
routedb_test=# select postgis_version();
postgis_version
---------------------------------------
2.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)
cat /etc/issue
Ubuntu 15.04
三: 安装依赖包
--3.1 安装 proj
下载地址: http://trac.osgeo.org/proj/
--简要步骤
# mkdir -p /home/postgres/pg_tool/proj
#./configure --prefix=/home/postgres/pg_tool/proj
# make
# make install
备注:安装过程中没报错,并且 /home/postgres/pg_tool/proj 目录下有文件,说明 proj 安装成功。
--3.2 安装 geos
下载地址: http://trac.osgeo.org/geos/
--简要步骤
# mkdir -p /home/postgres/pg_tool/geos
# ./configure --prefix=/home/postgres/pg_tool/geos --enable-python --enable-ruby
# make
# make check
# make install
--3.3 安装 JSON-C
下载地址: http://oss.metaparadigm.com/json-c/
--简要步骤
# wget http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz
# mkdir -p /home/postgres/pg_tool/json
# sh autogen.sh
# ./configure --prefix=/home/postgres/pg_tool/json
# make
# make install
--3.4 安装 GDAL
下载地址:http://trac.osgeo.org/gdal/wiki/DownloadSource
--简要步骤
# mkdir -p /home/postgres/pg_tool/gdal
# ./configure --prefix=/home/postgres/pg_tool/gdal
# make
# make install
--3.5 安装 libxml2
# sudo apt-get install libxml2-dev
备注:也可以在 http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html 下载。
--3.6 安装 postgis-2.2
--3.6.1 .bash_profile 新增以下环境变量
export PROJ_HOME=/home/postgres/pg_tool/proj
export GEOS_HOME=/home/postgres/pg_tool/geos
export GDAL_HOME=/home/postgres/pg_tool/gdal
export JSON_HOME=/home/postgres/pg_tool/json
export LD_LIBRARY_PATH=$GDAL_HOME/lib:$JSON_HOME/lib:$PROJ_HOME/lib:$GEOS_HOME/lib
备注:编缉完成后,执行.bash_profile 立即生效。
-- 3.6.2 下载 postgis-2.2
下载地址: http://postgis.refractions.net/download/
--3.6.3 configure
# ./configure --with-pgconfig=/opt/pgsql9.2.3/bin/pg_config --with-projdir=/home/postgres/pg_tool/proj --with-geosconfig=/home/postgres/pg_tool/geos/bin/geos-config --with-gdalconfig=/home/postgres/pg_tool/gdal/bin/gdal-config --with-jsondir=/home/postgres/pg_tool/json
备注:执行 configure 之后,如果没报错,会出现以下信息:
如图1
--3.6.4 编译并安装
# make
# make check
# sudo make install (注意需要sudo)
--3.7 安装 pgrouting2.2
下载地址:https://github.com/pgRouting/pgrouting
--简要步骤
# cd pgrouting
# makedir build
# cd build
# cmake ..
# make
# sudo make install
备注:需要安装依赖的包 libboost-thread-dev,libcgal-dev
详情阅读源码里的README.md
FAQ
Q1:create extension postgis
ERROR: could not load library "/home/postgres/pg/pgsql/lib/postgis-2.2.so": libproj.so.9: cannot open shared object file: No such file or directory
A1:安装postgis需要启动postgresql,注意把postgresql安装路径配置到path路径下,主要不要使用最新版本的postgresql
Q2:出现如图2所示错误

A2:注意不要安装最新版本的postgresql,最好apt-cache search postgresql
查看一下本系统支持的稳定版本的postgresql,其他如Q1
Q3:-1: error: collect2: ld returned 1 exit status
A3:注意gcc,和g++是否安装,sudo apt-get install build-essential bison libc6-dev
Q4:ERROR:AM_PROG_LIBTOOL command not found
A4:安装libtool包,执行 autoreconf -fvi 注意:最好需要重新生成configure文件,重新make
Q5:还有其他问题
A5:看一下readme.md里依赖的包安装没有,查看出错信息,定位错误原因,然后谷歌搜答案
ubuntu使用postgist,pgrouting的更多相关文章
- 路径分析—QGIS+PostgreSQL+PostGIS+pgRouting(一)
前言 因业务需求,需要做最短路径分析.最近几天查询资料,并自己动手,实现了简单的路径分析. 下面就介绍具体的实现过程. 本篇文章最终结果是在 PostgreSQL 数据库中实现的,后续的可视化展示会继 ...
- 关于ubuntu实机与虚机互相copy
我的开发环境是在ubuntu上的,但是ubuntu上没有官方支持的QQ,有些不太方便,所以在上面虚了一个Win7(先是win10,但是win10最新版本太坑了,不说了),不过经常会出现复制文件,或者文 ...
- 在Ubuntu下搭建ASP.NET 5开发环境
在Ubuntu下搭建ASP.NET 5开发环境 0x00 写在前面的废话 年底这段时间实在太忙了,各种事情都凑在这个时候,没时间去学习自己感兴趣的东西,所以博客也好就没写了.最近工作上有个小功能要做成 ...
- Ubuntu 14.04中Elasticsearch集群配置
Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...
- 在Ubuntu 16.10 安装 git 并上传代码至 git.oschina.net
1. 注册一个账号和创建项目 先在git.oschina.net上注册一个账号和新建一个project ,如project name 是"myTest". 2.安装git sudo ...
- 在Ubuntu 16.10安装mysql workbench报未安装软件包 libpng12-0错误
1.安装mysql workbench,提示未安装软件包 libpng12-0 下载了MySQL Workbench 6.3.8 在安装的时候报错: -1ubu1604-amd64.deb 提示: ...
- Ubuntu 16.10 安装KolourPaint 4画图工具
KolourPaint 4画图工具简单实用,可以绘画.视频处理和图标编辑: • 绘画:绘制图表和“手绘” • 视频处理:编辑截图和照片;应用特效 • 图标编辑:绘画剪贴和标识透明化 1.在Ubuntu ...
- 使用ubuntu作为web开发环境的一些感受
从ms-dos,win95,win98,winMe,winXp,vista,win7,win10我都有使用的经历,我使用时间最长的应属winxp,其次是win7,说实话,我觉得这两个系统是微软做的最好 ...
- ubuntu系统下如何修改host
Ubuntu系统的Hosts只需修改/etc/hosts文件,在目录中还有一个hosts.conf文件,刚开始还以为只需要修改这个就可以了,结果发现是需要修改hosts.修改完之后要重启网络.具体过程 ...
随机推荐
- MySql 数据库定时备份
1.使用sqldump+任务计划 mysqldump备份成sql文件==============假想环境:MySQL 安装位置:C:\MySQL论坛数据库名称为:bbsMySQL root 密 ...
- mysql 查询条件中文问题
这是mysql字符编码的问题,因为mysql默认的字符编码为latin1它并不识别中文,所以在读取查询语句时会出现乱码 从而使查询条件不正确所以我们只需要更改它的字符编码就可以一般都是用utf8 这里 ...
- C 根据行来读取文件 字符串的截取
// TestCFile.cpp : Defines the entry point for the console application. // #include "stdafx.h&q ...
- MVC-03 控制器(2)
五.ActionResult解说 ActionResult的继承图: 类型 Controller辅助方法 用途帮助 ContentResult Content 回传一个用户自定义的文字属性 Empty ...
- Hibernate JPA中@Transient、@JsonIgnoreProperties、@JsonIgnore、@JsonFormat、@JsonSerialize等注解解释
@jsonignore的作用作用是json序列化时将java bean中的一些属性忽略掉,序列化和反序列化都受影响. http://www.cnblogs.com/toSeeMyDream/p/443 ...
- HDOJ 1043 Eight(A* 搜索)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1043 思路分析: <1> 搜索算法: A*算法, Heuristic函数:曼哈顿距离 &l ...
- Book of Evil 树双向DFS
Book of Evil Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area ...
- HDU1284钱币兑换问题( 母函数打表)
题意:在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法.请你编程序计算出共有多少种兑法. 原题http://acm.hdu.edu.cn/showproblem.php?pid=128 ...
- 禁用Visual Studio 2013的Browser Link功能
禁用Visual Studio 2013的Browser Link功能 GET http://localhost:37478/7fd25f8af33f443494e765be19be6240/brow ...
- 比较和排序 IComparable And IComparer
1.List<Student>默认排序 为类创建默认排序实现IComparable,此代码的实现为年龄升序 using System; using System.Collections.G ...