[postgis-tickets] r14320 - note about PostGIS sfcgal extension

Regina Obe lr at pcorp.us
Sun Oct 25 13:31:09 PDT 2015


Author: robe
Date: 2015-10-25 13:31:08 -0700 (Sun, 25 Oct 2015)
New Revision: 14320

Added:
   web/_content/posts/2015/10-25_postgis_sfcgal_extension.html
Log:
note about PostGIS sfcgal extension

Added: web/_content/posts/2015/10-25_postgis_sfcgal_extension.html
===================================================================
--- web/_content/posts/2015/10-25_postgis_sfcgal_extension.html	                        (rev 0)
+++ web/_content/posts/2015/10-25_postgis_sfcgal_extension.html	2015-10-25 20:31:08 UTC (rev 14320)
@@ -0,0 +1,47 @@
+---
+title: Why can't I do CREATE EXTENSION postgis_sfcgal
+layout: post
+category: tips
+tags: [newbie,sfcgal,3d]
+author: Regina Obe
+thumbnail: postgis.png
+---
+<--markdown-->
+
+PostGIS 2.2.0 came out this month, and the SFCGAL extension that offers advanced 3D and volumetric support, in addition to some extended 2D functions like [`ST_ApproximateMedialAxis`](/docs/manual-2.2/ST_ApproximateMedialAxis.html) became a standard PostgreSQL extension
+and seems to be a fairly popular extension. 
+
+I've seen several reports on GIS Stack Exchange of people trying to install PostGIS SFCGAL and getting things such as
+
+ERROR: could not open extension control file /Applications/Postgres.app/Contents/Versions/9.5/share/postgresql/extension/postgis_sfcgal.control
+
+as in this question: <a href="http://gis.stackexchange.com/questions/167687/sfcgal-in-postgis-problem" target="_blank">SFCGAL in PostGIS problem</a>.
+
+There are two main causes for this:
+
+<!-- pagebreak -->
+
+1. The ``CREATE EXTENSION postgis_sfcgal;``  syntax is new in PostGIS 2.2. Although SFCGAL was available in PostGIS 2.1, 
+ you needed to use the sfcgal.sql script in contrib to install it.  So if you have PostGIS 2.1, you definitely can't use the CREATE EXTENSION syntax.
+ 
+2. postgis_sfcgal is not a default built extension when you build PostGIS.  There are 3 prequisites to get the extension during compile:
+
+  a. Need [Boost](http://www.boost.org/), [CGAL](http://www.cgal.org/), and [SFCGAL](http://sfcgal.org/). ``SFCGAL`` is compiled with [CMake](https://cmake.org/) similar to pgRouting. Note that Boost and CGAL are also prequisites of [pgRouting](http://pgrouting.org/), so you are almost there if you have pgRouting.  ``SFCGAL`` is a relatively thin wrapper for CGAL to allow CGAL functions to be used with SQL/MM 2D/3D types.
+  
+  b. You need to have in your PostGIS configure script: ```--with-sfcgal=\path\to\sfcgal-config``` as noted in [Configuration](/docs/manual-2.2/postgis_installation.html#installation_configuration)
+  
+  
+If you are getting PostGIS from a package distribution, be warned that few packagers that offer PostGIS 2.2 have postgis_sfcgal.
+
+I'm not even sure if any beyond the Windows application PostGIS 2.2. bundle stackbuilder package have it.  
+
+If you want it and your package maintainer doesn't carry it, 
+perhaps you can encourage them to.
+
+
+As a related warning:
+
+# Do Not install postgis_sfcgal (of PostGIS 2.2) in a PostGIS 2.1 or lower database
+
+Although the PostgreSQL extension system will allow it, do not try to use postgis_sfcgal packaged with PostGIS 2.2 with PostGIS 2.1.  
+The combination will be disastrous because you will end up with 2 PostGIS backends fighting each other.  



More information about the postgis-tickets mailing list