[原]CentOS7部署PostGis


轉載請注明原作者(think8848)和出處(http://think8848.cnblogs.com)

 

本文參考了《An almost idiot's guide to install PostgreSQL 9.5, PostGIS 2.2 and pgRouting 2.1.0 with Yum 》和PostGis官方網站的安裝說明

1. 先安裝Postgresql

請參見《CentOS7下安裝並簡單設置PostgreSQL筆記

2. 先安裝幾個以后能用的上的工具包,免得用的時候又沒有

sudo yum  install wget net-tools epel-release -y

3. 安裝PostGis

sudo yum install postgis2_95 postgis2_95-client -y

postgis2_95-client中包含了PostGis的命名行工具,如:shp2pgsql,pgsql2shp,raster2pgsql等,看名字也大概知道是什么意思了。

4. 安裝ogrfdw

ogrfdw的全稱是OGR Foreign Data Wrapper

sudo yum install ogr_fdw95 -y

更多ogr_fdw信息,請參見這里

5. 安裝pgRouting

sudo yum install pgrouting_95 -y

6. 建立一個Postgresql數據庫,然后安裝PostGis擴展

#先切換到postgres用戶,然后連接到postgres數據庫
su postgres

psql

#創建一個新的數據庫,指定數據庫所有者為think8848
CREATE DATABASE chinaosmgisdb OWNER think8848

#查看數據庫列表
\l

#切換到chinaosmgisdb數據庫
\c chinaosmgisdb

安裝PostGis擴展

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION ogr_fdw;

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;

 

7. 驗證安裝結果

SELECT postgis_full_version();

如果能成功顯示版本信息,說明PostGis成功安裝好了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM