2

The error "lwgeom_delaunay_triangulation: GEOS 3.4 or higher required" arrives on my terminal, running psql with

SELECT PostGIS_Lib_Version();
--   2.1.4

SELECT postgis_version();
-- 2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1

and when use use ST_DelaunayTriangles() (ex. in this script).

So, what is the problem, how re-install PostGis or workaround it?


EDIT for @janechii suggestion,

 select PostGIS_full_version();

POSTGIS="2.1.4 r12966" GEOS="3.3.3-CAPI-1.7.4" 
PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" 
LIBXML="2.8.0" LIBJSON="UNKNOWN" TOPOLOGY RASTER

PostGIS was installed all by standard apt-get in my Debian Stable this week, and now redo (try reinstall GEOS to use 3.4 not 3.3) with

sudo apt-get -y install postgis postgresql-9.3  libgeos-3.4 libgeos-c1 libgeos-dev

but no effect.

Peter Krauss
  • 2,292
  • 23
  • 43
  • Will check this today: 1 and 2 to fix. – Peter Krauss Oct 06 '14 at 11:12
  • Run SELECT postgis_full_version(); and update your question with the output. Your operating system would also be helpful when talking about upgrades. The links you provided seem to be good solutions. Let us know if they work! – janechii Oct 06 '14 at 23:48
  • @janechii, thanks (!). I edited. Perhaps must use apt-get remove purge libgeos-3.3? How check if there are two GEOS's? ... Or as suggested by JohnBarça, I need have to resort to building from source... No rationale option? – Peter Krauss Oct 07 '14 at 00:42

3 Answers3

2

After all @janechii clues.... and purging all possible residuals,

 sudo apt-get purge build-essential libgeos-3.4 libgeos-c1 libgeos-dev  libxml2-dev libgdal-dev libproj-dev libjson0-dev xsltproc docbook-xsl docbook-mathml
 sudo apt-get purge postgis

I statart with (adapting!) recipes of this link:

 wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
 tar xfj geos-3.4.2.tar.bz2
 cd geos-3.4.2
 ./configure
 make
 sudo make install
 cd ..

At here ok geos 3.4 there (!). Then...

 wget http://download.osgeo.org/postgis/source/postgis-2.1.3.tar.gz
 tar xfz postgis-2.1.3.tar.gz
 cd postgis-2.1.3
 ./configure
 sudo make install  

this last make trigg a "configure: error: the PGXS Makefile (...) cannot be found. Please install the PostgreSQL server development packages and re-run configure". So, as some more clues here do

 sudo apt-get install postgresql-server-dev-9.3

so red config,

 ./configure

then ok, a good msg:

  PostGIS is now configured for x86_64-unknown-linux-gnu

  -------------- Compiler Info ------------- 
    C compiler:           gcc -g -O2
    C++ compiler:         g++ -g -O2
    SQL preprocessor:     /usr/bin/cpp -w -traditional-cpp -P

   -------------- Dependencies -------------- 
    GEOS config:          /usr/local/bin/geos-config
    GEOS version:         3.4.2
  ...
   --------------- Extensions --------------- 
    PostGIS Raster:       enabled
    PostGIS Topology:     enabled
    SFCGAL support:       disabled

   -------- Documentation Generation -------- 
    xsltproc:             /usr/bin/xsltproc
    ....

Then, continue:

 make
      # PostGIS was built successfully. Ready to install.
 sudo make install
 sudo ldconfig
 sudo make comments-install


 sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql
 sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp
 sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql


 psql -h localhost -U postgres postgres
 CREATE EXTENSION postgis;
 CREATE EXTENSION postgis_topology;
 \q

Then, testing with this script... OK!!!!

Peter Krauss
  • 2,292
  • 23
  • 43
1

I had a similar issue. Even recompiling against the new GEOS didn't help when you have 2 versions. It kept trying to use the older version.

Firstly, try to uninstall the old library, and see if that works. If not, try to follow this link's instructions using a custom PostgreSQL repository.

If all else fails, check your ldconfig to see if older version of libgeos are still installed and simlinked somewhere and remove them:

ldconfig -p | grep libgeos

Otherwise, recompiling PostGIS from scratch is pretty simple. Follow the official documentation and you should be good to go. You'll probably need dev packages from postgres, proj4, geos, and gdal. See compatatibility chart.

Hope this helps!

janechii
  • 1,078
  • 6
  • 10
1

Try uninstalling all versions of GEOS and then reinstall only the latest version you need.

Here's the detailed steps I followed for that:

  1. You can list all the installed versions by running either ldconfig -p | grep libgeos or dpkg -l | grep libgeos
  2. Uninstall all those versions by running sudo apt purge libgeos-(whatever_versions_you_have)
  3. Now, be sure that the step 1. above returns an empty list. If not, go back to step 2.
  4. Perform a little clean-up with sudo apt autoremove and sudo apt clean
  5. Install the GEOS version you need (and only this one) with both sudo apt install libgeos-(whatever_version_you_need) AND sudo apt install libgeos-c(whatever_version_you_need) (this last one can be for ex. something like sudo apt install libgeos-c1v5 or just sudo apt install libgeos-c1 for older versions)
  6. Run ldconfig -p | grep libgeos again to check that you now have all the pieces required. Now you should see TWO and only two lines there: one starting with libgeos_c.so and the other one starting with libgeos-(whatever-version-you-installed)
  7. Check if PostGIS is still correctly installed (in my case, it had been autonomatically uninstalled by the preceding steps…) by running sudo apt list --installed | grep postgresql (you should see at least 2 lines there: one starting with postgresql-X-postgis-Z and one starting with postgresql-X-postgis-Z-scripts). If one is missing, reinstall PostGIS by running sudo apt install postgresql-X-postgis-Z postgresql-X-postgis-Z-scripts (of course you need to replace X and Z respectively with the version of your PostgreSQL server and the PostGIS version you need)
  8. Launch PostgreSQL's command line interface with sudo -u postgres psql and type the following commands: select postgis_extensions_upgrade(); select postgis_full_version(); This last command should now display the right versions of GEOS and PostGIS.
Pigeo
  • 11
  • 1