SFCGAL and GUC postgis.backend
lr at pcorp.us
lr at pcorp.us
Tue Apr 15 06:38:43 PDT 2025
Sorry about that, guess we never removed it from the docs. I'll put a note
it's no longer needed.
It doesn't do anything as of PostGIS 3.0 or 3.1 -- have to check which
version we dropped that.
The only reason it was needed was for those functions like ST_3DIntersects
that shared the same name with PostGIS functions.
But since the split of postgis_sfcgal as a separate library and requirement
we will no longer overlap names, that is no longer useful.
The main casualty of this was ST_3DIntersects as there was useful behavior
that SFCGAL had that PostGIS didn't.
SFCGAL 3D Intersects from 3.5 on has been resuscitated as -
https://postgis.net/docs/CG_3DIntersects.html
> -----Original Message-----
> From: Erik Wienhold <ewie at ewie.name>
> Sent: Tuesday, April 15, 2025 5:23 AM
> To: postgis-users at lists.osgeo.org
> Subject: SFCGAL and GUC postgis.backend
>
> I'm confused about whether GUC postgis.backend really has to be set when
> using SFCGAL functions. https://postgis.net/docs/postgis_backend.html
> is explicit about making sfcgal the backend in this case. But I get the
same
> results for backends geos and sfcgal when using the example from
> https://postgis.net/docs/CG_ApproximateMedialAxis.html. Are there corner
> cases where the backend makes a difference?
>
> Reproducer:
>
> SELECT version();
> CREATE EXTENSION IF NOT EXISTS postgis;
> CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;
> SELECT postgis_full_version();
> SET postgis.backend = geos;
> SELECT st_astext(cg_approximatemedialaxis('POLYGON (( 190 190, 10
> 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190
> ))'::geometry));
> SET postgis.backend = sfcgal;
> SELECT st_astext(cg_approximatemedialaxis('POLYGON (( 190 190, 10
> 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190
> ))'::geometry));
>
> Output:
>
> SELECT version();
> version
>
----------------------------------------------------------------------------
--------
> ---------------------------------
> PostgreSQL 16.8 (Debian 16.8-1.pgdg120+1) on x86_64-pc-linux-
> gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
> (1 row)
>
> CREATE EXTENSION IF NOT EXISTS postgis;
> CREATE EXTENSION
> CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;
> CREATE EXTENSION
> SELECT postgis_full_version();
>
> postgis_full_version
>
----------------------------------------------------------------------------
--------
>
----------------------------------------------------------------------------
------------------
>
----------------------------------------------------------------------------
------------------
>
----------------------------------------------------------------------------
------------------
> ------------------------------
> POSTGIS="3.5.2 dea6d0a" [EXTENSION] PGSQL="160"
> GEOS="3.11.1-CAPI-1.17.1" SFCGAL="SFCGAL 1.4.1, CGAL 5.5.1, BOOST
> 1.74.0" PROJ="9.1.1 NETWORK_ENABLED=OFF
> URL_ENDPOINT=https://cdn.proj.org
> USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj
> DATABASE_PATH=/usr/share/proj/proj.db" (compiled against PROJ 9.1.1)
> LIBXML="2.9.14" LIBJSON="0.16" LIBPROTOBUF="1.4.1" WAGYU="0.5.0
> (Internal)"
> (1 row)
>
> SET postgis.backend = geos;
> SET
> SELECT st_astext(cg_approximatemedialaxis('POLYGON (( 190 190, 10
> 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190
> ))'::geometry));
>
> st_astext
>
----------------------------------------------------------------------------
--------
>
----------------------------------------------------------------------------
------------------
>
----------------------------------------------------------------------------
------------------
> --------------------
> MULTILINESTRING((184.18861169915812
> 15.811388300841896,158.3772233983162 20),(50
> 20,158.3772233983162 20),(50 20,35 35),(35 153.15077848154866,35
> 35),(35 153.15077848154866,40.697077206292434
> 159.30292279370755),(164.03987973986756
> 164.03987973986756,40.697077206292434 159.30292279370755))
> (1 row)
>
> SET postgis.backend = sfcgal;
> SET
> SELECT st_astext(cg_approximatemedialaxis('POLYGON (( 190 190, 10
> 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190
> ))'::geometry));
>
> st_astext
>
----------------------------------------------------------------------------
--------
>
----------------------------------------------------------------------------
------------------
>
----------------------------------------------------------------------------
------------------
> --------------------
> MULTILINESTRING((184.18861169915812
> 15.811388300841896,158.3772233983162 20),(50
> 20,158.3772233983162 20),(50 20,35 35),(35 153.15077848154866,35
> 35),(35 153.15077848154866,40.697077206292434
> 159.30292279370755),(164.03987973986756
> 164.03987973986756,40.697077206292434 159.30292279370755))
> (1 row)
>
> --
> Erik Wienhold
More information about the postgis-users
mailing list