SFCGAL and GUC postgis.backend
Erik Wienhold
ewie at ewie.name
Tue Apr 15 02:23:05 PDT 2025
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