Monday, 15 February 2016

How to update PostGIS 2.1 to use `ST_DelaunayTriangles()`


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.



Answer



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!!!!



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...