Wednesday, 5 April 2017

postgresql - Cannot create PostGIS extension with Ubuntu 18.04


I am a few days new to Linux Ubuntu and am in the process of setting up a PostGIS database to use in GeoDjango.



I am going to post all my commands that I have done so far


these are installed in order:


-------------------------------postgres------------------------
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install postgresql postgresql-contrib libpq-dev pgadmin4


sudo apt-get install postgis

-------------------------------geodjango------------------------

sudo apt-get install binutils libproj-dev gdal-bin
sudo apt-get install build-essential
sudo apt-get install gcc g++ clang make

--geos

wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
tar xjf geos-3.4.2.tar.bz2
cd geos-3.4.2
export CXX="g++ -std=c++98"
./configure
make
sudo make install
cd ..

--proj 4

wget http://download.osgeo.org/proj/proj-4.9.1.tar.gz
wget http://download.osgeo.org/proj/proj-datumgrid-1.5.tar.gz
tar xzf proj-4.9.1.tar.gz
cd proj-4.9.1/nad
tar xzf ../../proj-datumgrid-1.5.tar.gz
cd ..
./configure
make
sudo make install
cd ..


--gdal
wget http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz
tar xzf gdal-2.2.0.tar.gz
cd gdal-2.2.0
./configure
make
sudo make install

now when I go into pgAdmin 4 and run create extension postgis i get this error



ERROR:  could not load library "/usr/lib/postgresql/10/lib/postgis-2.4.so": /usr/lib/liblwgeom-2.4.so.0: undefined symbol: GEOSVoronoiDiagram
SQL state: XX000

UPDATE


followed the directions in this link https://kitcharoenp.github.io/postgresql/postgis/2018/05/28/set_up_postgreSQL_postgis.html and still got the same error



Answer



The error message points to GEOS,



ERROR: could not load library "/usr/lib/postgresql/10/lib/postgis-2.4.so": /usr/lib/liblwgeom-2.4.so.0: undefined symbol: GEOSVoronoiDiagram




You might have better luck with installing a more recent version of GEOS (see e.g. Error building GEOS on Ubuntu 18.04):


Replace 3.4.2 with 3.6.2 in:


--geos
wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
tar xjf geos-3.4.2.tar.bz2
cd geos-3.4.2
export CXX="g++ -std=c++98"
./configure
make
sudo make install

cd ..

-- Update --


With new versions of GEOS, you also don't need the CXX flag, which forces (a quite) old C++ standard. When possible, I'd try to compile the libraries with the same compiler and settings with PostgreSQL.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...