ST_ForceSFS — Force geometries to use SFS 1.1 or 1.2 geometry types.
geometry ST_ForceSFS(geometry geomA);
geometry ST_ForceSFS(geometry geomA, text version);
Forces a geometry to use the geometry types defined by the requested version of the OGC Simple Features Specification. The default is SFS 1.1. Curved geometries are converted to linear representations, TRIANGLE is converted to POLYGON, and TIN and POLYHEDRALSURFACE are converted to GEOMETRYCOLLECTION values containing POLYGON elements.
If version begins with 1.2, curved geometries are still converted to linear representations, but TRIANGLE, TIN, and POLYHEDRALSURFACE are preserved. Other version values use the default SFS 1.1 behavior. Geometry collections are processed recursively, and the SRID and Z/M coordinates are preserved.
Verfügbarkeit: 2.1.0
Diese Funktion unterstützt polyedrische Flächen.
Diese Funktion unterstützt Dreiecke und dreieckige unregelmäßige Netzoberflächen (TIN).
Diese Methode unterstützt kreisförmige Strings und Kurven.
Diese Funktion unterstützt 3d und lässt den Z-Index nicht fallen.
Compare the geometry types produced for SFS 1.1 (the default) and SFS 1.2. Read each row from the input type in the direction of the result columns.
WITH inputs(geom) AS (VALUES
('CIRCULARSTRING(0 0, 1 1, 2 0)'::geometry),
('TRIANGLE((0 0, 0 2, 2 0, 0 0))'::geometry),
('TIN(((0 0, 0 2, 2 0, 0 0)))'::geometry),
('POLYHEDRALSURFACE(((0 0, 0 2, 2 0, 0 0)))'::geometry)
)
SELECT ST_GeometryType(geom) || ' →' AS input,
ST_GeometryType(ST_ForceSFS(geom)) AS "SFS 1.1 (default)",
ST_GeometryType(ST_ForceSFS(geom, '1.2')) AS "SFS 1.2"
FROM inputs;
input | SFS 1.1 (default) | SFS 1.2 ------------------------+-----------------------+---------------------- ST_CircularString → | ST_LineString | ST_LineString ST_Triangle → | ST_Polygon | ST_Triangle ST_Tin → | ST_GeometryCollection | ST_Tin ST_PolyhedralSurface → | ST_GeometryCollection | ST_PolyhedralSurface (4 rows)