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.

  • Will check this today: 1 and 2 to fix. – Peter Krauss Oct 6 '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 6 '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 7 '14 at 0:42
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!!!!

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!

  • The instrutins are good clue, but there are a apt-get install that only installs "libgeos-3.3.3"... Perhaps this answer – Peter Krauss Oct 7 '14 at 17:22
  • .. hum, your link to compatatibility chart says "(...) requires both PostGIS 2.1 and GEOS 3.4+. 3.4 also brought ST_DelaunayTriangles so you won't get that in 2.1 if you don't compile for 3.4+."... well, how to "compile for 3.4"?! – Peter Krauss Oct 7 '14 at 17:52
  • ... This is for UBUBTU, perhaps I can use for Debian Stable. – Peter Krauss Oct 7 '14 at 17:59
  • any luck with your solution? – janechii Oct 8 '14 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.