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.
Disponibilité : 2.1.0
Cette fonction prend en charge les surfaces Polyhedral.
Cette fonction prend en charge les triangles et les réseaux irréguliers triangulés (TIN).
Cette méthode prend en charge les types Circular String et Curve.
Cette fonction prend en charge la 3D et ne supprime pas l'indice z.
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)