CentOS安装PostGIS

老子叫甜甜 提交于 2020-04-06 10:00:46

PostGIS是PostgreSQL的一个插件,需要注意其版本匹配关系,详细的版本匹配关系可以在官网(https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS)上找到。

1、安装epel

yum -y install epel-release

2、安装PostGIS

版本号格式为:_前为postgis版本,后面为postgresql版本。

yum install postgis2_96

这里匹配的是PostGIS2.4版本。

3、新建扩展 

安装完postgis后,需要先激活数据库上的PostGIS功能,然后才能存储空间数据,才可以使用空间数据库功能。

切换到操作系统的postgres用户

sudo -i -u postgres

连接到数据库

-bash-4.2$ psql -d scgis

新建扩展

scgis=# CREATE EXTENSION postgis;

附完整的扩展

-- 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;

CREATE EXTENSION ogr_fdw;
CREATE EXTENSION pgrouting;
CREATE EXTENSION pointcloud;
CREATE EXTENSION pointcloud_postgis;

验证PostGIS版本

scgis=# SELECT PostGIS_version();
scgis=# SELECT postgis_full_version();

参考:

https://www.cnblogs.com/giser-s/p/11195697.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!