导航

PostgreSQL 之 yum安装 postgis 插件

Posted on 2018-10-24 15:49  许爱琪  阅读(3685)  评论(2编辑  收藏  举报

版本说明:

CentOS7.5 + PostgreSQL 10.5

 

参考资源:

https://www.postgresql.org/download/linux/redhat/

http://download.osgeo.org/postgis/source/   postgis下载ftp网站

https://trac.osgeo.org/geos/                          geos官方网站

https://blog.csdn.net/xzwspy/article/details/80082082?utm_source=blogxgwz3     源码安装postgis,注意各个版本的兼容性

https://www.cnblogs.com/ilifeilong/p/6979288.html                                                    源码安装postgis,注意各个版本的兼容性

https://blog.csdn.net/learn_tech/article/details/80195566                                                 源码安装gdal

http://2057.iteye.com/blog/1616620                                                                                  

安装postgresql

#Install the repository RPM
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

#Install the client packages
yum install postgresql10

#Optionally install the server packages
yum install postgresql10-server

#Optionally initialize the database and enable automatic start
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10

Platform support

安装PostGIS

1.先安装几个工具包

yum install wget net-tools epel-release -y

然后安装postgis

yum install postgis24_10 postgis24_10-client -y

安装拓展工具

yum install ogr_fdw10 -y
yum install pgrouting_10 -y

2.创建数据库postgis

CREATE DATABASE postgis OWNER postgres;

切换新创建的database

\c postgis

安装PostGis扩展

postgis=# CREATE EXTENSION postgis;
postgis=# CREATE EXTENSION postgis_topology;
postgis=# CREATE EXTENSION ogr_fdw;

然后可以验证是否安装成功

SELECT postgis_full_version();

 

另外,下面是官方网站点列的一份扩展:

-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
-- sfcgal not available with all distributions
CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
CREATE EXTENSION address_standardizer;
-- example rule data set
CREATE EXTENSION address_standardizer_data_us;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;