在 Ubuntu 14.04.2 上啟用 PostGIS 擴充

在 Ubuntu 14.04.2 上啟用 PostGIS 擴充

我在 Ubuntu 14.04.2 和 PostgreSQL 9.3 上啟用 PostGIS 擴充功能時遇到問題。我已經按照這個步驟安裝了軟體包程式

PostgreSQL 和 pgAdminIII 似乎已正確安裝。我可以啟動 pgAdminIII 並且本地主機預設伺服器存在。我新增一個新的資料庫並輸入CREATE EXTENSION postgis;.我收到以下錯誤:

ERROR:  could not open extension control file "/usr/share/postgresql/9.3/extension/postgis.control": Aucun fichier ou dossier de ce type

有人可以幫忙嗎?我想我離成功不遠了...

多謝!

答案1

您必須在資料庫上安裝postgis、打包並建立 postgis 擴展postgresql-9.3-postgis-2.1

sudo apt-get install postgis postgresql-9.3-postgis-2.1
sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" DATABASE_NAME_HERE

參考:喬恩聖徒的教程

答案2

wget http://download.osgeo.org/postgis/source/postgis-2.1.8.tar.gz
tar xfvz postgis-2.1.8.tar.gz
cd postgis-2.1.8
./configure --with-pgconfig=/usr/lib/postgresql/9.4/bin/pg_config --without-raster
make && make install

現在我遇到了一個問題,即postgis庫看不到proj庫,從執行時的「未找到」可以看出ldd /usr/lib/postgresql/9.4/lib/postgis-2.1.so。解決方案是對其進行軟連結:

ln /usr/local/lib/libproj.so.9.1.0 /usr/lib/libproj.so.9

相關內容