做網(wǎng)站用什么后綴好網(wǎng)站模板
PostGIS的最新版本已經(jīng)到3.5,但是還有一些國產(chǎn)數(shù)據(jù)庫內(nèi)核使用的舊版本的PostgreSQL,支持PostGIS2.4。但PostGIS2.4的版本已經(jīng)在yum中找不到了,安裝只能通過本地編譯的方式。這里介紹一下如何在Centos7的系統(tǒng)上,編譯部署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
安裝完成后測試
安裝 成功測試
在數(shù)據(jù)庫執(zhí)行下面SQL
CREATE EXTENSION postgis;SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) As wkt;