PostGIS的最新版本已经到3.5,但是还有一些国产数据库内核使用的旧版本的PostgreSQL,支持PostGIS2.4。但PostGIS2.4的版本已经在yum中找不到了,安装只能通过本地编译的方式。这里介绍一下如何在Centos7的系统上,编译部署PostGIS2.4。
安装Proj4
wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz
tar -xf proj-4.9.3.tar.gz
cd proj-4.9.3
./configure --prefix=/usr/local/pgsql/plugin/proj
make
make install
echo "/usr/local/pgsql/plugin/proj/lib" > /etc/ld.so.conf.d/proj-4.9.3.conf
ldconfig
安装GEOS
wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2
tar -jxf geos-3.6.2.tar.bz2
cd geos-3.6.2
./configure --prefix=/usr/local/pgsql/plugin/geos
make
make install
echo "/usr/local/pgsql/plugin/geos/lib" > /etc/ld.so.conf.d/geos-3.6.2.conf
ldconfig
安装libxml2
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.1.tar.gz
tar -xzvf libxml2-2.7.1.tar.gz
cd libxml2-2.7.1
./configure --prefix=/usr/local/pgsql/plugin/libxml2
make
make install
echo "/usr/local/pgsql/plugin/geos/lib" > /etc/ld.so.conf.d/geos-3.6.1.conf
ldconfig
安装GDAL
wget http://download.osgeo.org/gdal/2.1.2/gdal-2.1.2.tar.gz
tar -xf gdal-2.1.2.tar.gz
cd gdal-2.1.2
./configure --prefix=/usr/local/pgsql/plugin/gdal
make
make install
echo "/usr/local/pgsql/plugin/gdal/lib" > /etc/ld.so.conf.d/gdal-2.1.2.conf
ldconfig
安装JSON-C
wget https://github.com/json-c/json-c/archive/refs/tags/json-c-0.12.1-20160607.tar.gz
tar -xzvf json-c-0.12.1-20160607.tar.gz
cd json-c-0.12.1-20160607/
chmod +x ./configure
./configure --prefix=/usr/local/pgsql/plugin/json
make && make install
安装PostGIS
wget http://download.osgeo.org/postgis/source/postgis-2.4.9.tar.gz
tar -xf postgis-2.4.9.tar.gz
cd postgis-2.4.9
./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
make
make install
安装完成后测试
安装 成功测试
在数据库执行下面SQL
CREATE EXTENSION postgis;
SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) As wkt;
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » PostGIS2.4服务器编译安装
发表评论 取消回复