iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >安装PostGIS-2.1.8
  • 503
分享到

安装PostGIS-2.1.8

2024-04-02 19:04:59 503人浏览 薄情痞子
摘要

版本:proj-4.8.0.tar.gzgeos-3.4.2.tar.bz2gdal-2.0.1.tar.gzPostGIS-2.1.82.1.8前提条件:安装PostGIS之前必须先安装proj,geos

版本:

proj-4.8.0.tar.gz

geos-3.4.2.tar.bz2

gdal-2.0.1.tar.gz

PostGIS-2.1.82.1.8


前提条件:

安装PostGIS之前必须先安装proj,geos,gdal.


安装proj4

[root@Darren2 tools]# wget Http://download.osgeo.org/proj/proj-4.8.0.tar.gz

[root@Darren2 tools]# tar xf proj-4.8.0.tar.gz

[root@Darren2 tools]# cd proj-4.8.0

[root@Darren2 proj-4.8.0]# ./configure --prefix=/usr/local/pgsql/plugin/proj

[root@Darren2 proj-4.8.0]# make && make install

Waiting for about 1min


#配置和加载动态链接库:

[root@Darren2 proj-4.8.0]# vim /etc/ld.so.conf.d/proj-4.8.0.conf

/usr/local/pgsql/plugin/proj/lib

[root@Darren2 proj-4.8.0]# ldconfig


安装geos

[root@Darren2 tools]# wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2

[root@Darren2 tools]# bzip2 -d geos-3.4.2.tar.bz2

[root@Darren2 tools]# tar xf geos-3.4.2.tar

[root@Darren2 geos-3.4.2]# ./configure --prefix=/usr/local/pgsql/plugin/geos

......

Swig: false

python bindings: false

Ruby bindings: false

PHP bindings: false

#这些可忽略


[root@Darren2 geos-3.4.2]# make && make install

Waiting for about 5min


#配置和加载动态链接库:

[root@Darren2 geos-3.4.2]# vim /etc/ld.so.conf.d/geos-3.4.2.conf

/usr/local/pgsql/plugin/geos/lib

[root@Darren2 geos-3.4.2]# ldconfig


安装gdal

[root@Darren2 tools]# wget http://download.osgeo.org/gdal/2.0.1/gdal-2.0.1.tar.gz

[root@Darren2 tools]# tar xf gdal-2.0.1.tar.gz

[root@Darren2 tools]# cd gdal-2.0.1

[root@Darren2 gdal-2.0.1]# ./configure --prefix=/usr/local/pgsql/plugin/gdal

[root@Darren2 gdal-2.0.1]#make && make install

Waiting for about 15min


#配置和加载动态链接库:

[root@Darren2 gdal-2.0.1]# vim /etc/ld.so.conf.d/gdal-2.0.1.conf

/usr/local/pgsql/plugin/gdal/lib

[root@Darren2 gdal-2.0.1]# ldconfig


安装PostGIS

[root@Darren2 tools]# wget http://download.osgeo.org/postgis/source/postgis-2.1.8.tar.gz

[root@Darren2 tools]# tar xf postgis-2.1.8.tar.gz

./configure --help参数:

  --prefix=PREFIX         install architecture-independent files in PREFIX [/usr/local]

  --with-pGConfig=FILE    specify an alternative pg_config file

  --with-geosconfig=FILE  specify an alternative geos-config file

  --with-projdir=PATH     specify the PROJ.4 installation directory

  --without-raster        Disable the raster extension


[root@Darren2 postgis-2.1.8]# ./configure --prefix=/usr/local/pgsql/plugin/postgis \

--with-pgconfig=/usr/local/pgsql/bin/pg_config \

--with-geosconfig=/usr/local/pgsql/plugin/geos/bin/geos-config \

--with-gdalconfig=/usr/local/pgsql/plugin/gdal/bin/gdal-config \

--with-projdir=/usr/local/pgsql/plugin/proj

.........

PostGIS is now configured for x86_64-unknown-linux-gnu

 -------------- Compiler Info -------------

  C compiler:           gcc -g -O2

  c++ compiler:         g++ -g -O2

  SQL preprocessor:     /usr/bin/cpp -w -traditional-cpp -P

 -------------- Dependencies --------------

  GEOS config:          /opt/geos-3.4.2/bin/geos-config

  GEOS version:         3.4.2

  GDAL config:          /usr/local/bin/gdal-config

  GDAL version:         2.0.1

  postgresql config:    /usr/local/pgsql/bin/pg_config

  PostgreSQL version:   PostgreSQL 9.6.3

  PROJ4 version:        48

  Libxml2 config:       /usr/bin/xml2-config

  Libxml2 version:      2.7.6

  JSON-C support:       no

  PostGIS debug level:  0

  Perl:                 /usr/bin/perl

 --------------- Extensions ---------------

  PostGIS Raster:       enabled

  PostGIS Topology:     enabled

  SFCGAL support:       disabled

 -------- Documentation Generation --------

  xsltproc:             

  xsl style sheets:     

  dblatex:             

  convert:             

  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd


#编译

[root@Darren2 postgis-2.1.8]# make

......

PostGIS was built successfully. Ready to install.

[root@Darren2 postgis-2.1.8]# make install

......

make[2]: Leaving directory `/home/tools/postgis-2.1.8/extensions/postgis_topology'

make[1]: Leaving directory `/home/tools/postgis-2.1.8/extensions'

Wait for about 1min


检查PostGIS是否安装成功

Darren2:postgres:/usr/local/pgsql:>psql

postgres=# select * from pg_available_extensions where name like 'postgis%';

          name          | default_version | installed_version |                               comment                               

------------------------+-----------------+-------------------+---------------------------------------------------------------------

 postgis                | 2.1.8           |                   | PostGIS geometry, geography, and raster spatial types and functions

 postgis_tiger_geocoder | 2.1.8           |                   | PostGIS tiger geocoder and reverse geocoder

 postgis_topology       | 2.1.8           |                   | PostGIS topology spatial types and functions

postgres=# create extension postgis;

postgres=# create extension postgis_topology;

postgres=# create extension fuzzystrmatch;

postgres=# create extension postgis_tiger_geocoder;

postgres=# \dx

                                            List of installed extensions

          Name          | Version |   Schema   |                             Description                             

------------------------+---------+------------+---------------------------------------------------------------------

fuzzystrmatch          | 1.1     | public     | determine similarities and distance between strings

plpgsql                | 1.0     | pg_catalog | PL/pgSQL procedural language

postgis                | 2.1.8   | public     | PostGIS geometry, geography, and raster spatial types and functions

postgis_tiger_geocoder | 2.1.8   | tiger      | PostGIS tiger geocoder and reverse geocoder

postgis_topology       | 2.1.8   | topology   | PostGIS topology spatial types and functions


Error

(1)

[root@Darren2 postgis-2.1.8]# ./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=/opt/geos-3.4.2/bin/geos-config --with-projdir=/opt/proj-4.8.0/ --without-sfcgal

......

checking for xml2-config... no

configure: error: could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.

解决方法:

查看是否存在xml2-config文件,结果不存在

[root@Darren2 postgis-2.1.8]# find / -name "xml2-config"

查看是否已经安装了libxml2和libxml2-devel

[root@Darren2 postgis-2.1.8]# rpm -qa |grep  libxml2

libxml2-2.7.6-14.el6.x86_64

libxml2-Python-2.7.6-14.el6.x86_64

安装libxml2-devel:

[root@Darren2 postgis-2.1.8]# yum install libxml2-devel -y

[root@Darren2 postgis-2.1.8]# rpm -qa |grep  libxml2

libxml2-2.7.6-21.el6_8.1.x86_64

libxml2-python-2.7.6-21.el6_8.1.x86_64

libxml2-devel-2.7.6-21.el6_8.1.x86_64

可以看到此时已经有xml2-config文件

[root@Darren2 postgis-2.1.8]# find / -name "xml2-config"

/usr/bin/xml2-config

最后再执行上面的编译命令可成功。


(2)创建extension时报错

postgres=# create extension postgis;

ERROR:  could not load library "/usr/local/pgsql/lib/rtpostgis-2.1.so": libgdal.so.20: cannot open shared object file: No such file or directory

[root@Darren2 postgis-2.1.8]# ls -ltr /usr/local/pgsql/lib/rtpostgis-2.1.so

-rwxr-xr-x. 1 root root 1435637 Jul 12 05:44 /usr/local/pgsql/lib/rtpostgis-2.1.so

[root@Darren2 postgis-2.1.8]# ls -ltr /usr/local/pgsql/lib/libgdal.so.20

ls: cannot access /usr/local/pgsql/lib/libgdal.so.20: No such file or directory

[root@Darren2 postgis-2.1.8]# find / -name 'libgdal.so.20'

/usr/local/lib/libgdal.so.20

/home/tools/gdal-2.0.1/.libs/libgdal.so.20

[root@Darren2 postgis-2.1.8]# cp /usr/local/lib/libgdal.so.20 /usr/local/pgsql/lib/


您可能感兴趣的文档:

--结束END--

本文标题: 安装PostGIS-2.1.8

本文链接: https://www.lsjlt.com/news/35790.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • oracle怎么查询当前用户所有的表
    要查询当前用户拥有的所有表,可以使用以下 sql 命令:select * from user_tables; 如何查询当前用户拥有的所有表 要查询当前用户拥有的所有表,可以使...
    99+
    2024-05-15
    oracle
  • oracle怎么备份表中数据
    oracle 表数据备份的方法包括:导出数据 (exp):将表数据导出到外部文件。导入数据 (imp):将导出文件中的数据导入表中。用户管理的备份 (umr):允许用户控制备份和恢复过程...
    99+
    2024-05-15
    oracle
  • oracle怎么做到数据实时备份
    oracle 实时备份通过持续保持数据库和事务日志的副本来实现数据保护,提供快速恢复。实现机制主要包括归档重做日志和 asm 卷管理系统。它最小化数据丢失、加快恢复时间、消除手动备份任务...
    99+
    2024-05-15
    oracle 数据丢失
  • oracle怎么查询所有的表空间
    要查询 oracle 中的所有表空间,可以使用 sql 语句 "select tablespace_name from dba_tablespaces",其中 dba_tabl...
    99+
    2024-05-15
    oracle
  • oracle怎么创建新用户并赋予权限设置
    答案:要创建 oracle 新用户,请执行以下步骤:以具有 create user 权限的用户身份登录;在 sql*plus 窗口中输入 create user identified ...
    99+
    2024-05-15
    oracle
  • oracle怎么建立新用户
    在 oracle 数据库中创建用户的方法:使用 sql*plus 连接数据库;使用 create user 语法创建新用户;根据用户需要授予权限;注销并重新登录以使更改生效。 如何在 ...
    99+
    2024-05-15
    oracle
  • oracle怎么创建新用户并赋予权限密码
    本教程详细介绍了如何使用 oracle 创建一个新用户并授予其权限:创建新用户并设置密码。授予对特定表的读写权限。授予创建序列的权限。根据需要授予其他权限。 如何使用 Oracle 创...
    99+
    2024-05-15
    oracle
  • oracle怎么查询时间段内的数据记录表
    在 oracle 数据库中查询指定时间段内的数据记录表,可以使用 between 操作符,用于比较日期或时间的范围。语法:select * from table_name wh...
    99+
    2024-05-15
    oracle
  • oracle怎么查看表的分区
    问题:如何查看 oracle 表的分区?步骤:查询数据字典视图 all_tab_partitions,指定表名。结果显示分区名称、上边界值和下边界值。 如何查看 Oracle 表的分区...
    99+
    2024-05-15
    oracle
  • oracle怎么导入dump文件
    要导入 dump 文件,请先停止 oracle 服务,然后使用 impdp 命令。步骤包括:停止 oracle 数据库服务。导航到 oracle 数据泵工具目录。使用 impdp 命令导...
    99+
    2024-05-15
    oracle
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作