ST_PatchN — 返回多面体曲面的第N个几何图形(面)。
geometry
ST_PatchN
(
geometry
geomA
, integer
n
)
;
如果第N个几何图形是POLYHEDRALSURFACE或POLYHEDRALSURFACEM,则返回从1开始的第N个几何图形(面)。否则,返回NULL。这将返回与多面体曲面的ST_GeometryN相同的答案。使用ST_GeometryN更快。
![]() |
|
索引以1为基数。 |
![]() |
|
如果要提取几何图形的所有元素 ST_Dump 效率更高。 |
可用性:2.0.0
This method implements the SQL/MM specification. SQL-MM 3:?
This function supports 3d and will not drop the z-index.
This function supports Polyhedral surfaces.
--Extract the 2nd face of the polyhedral surface
SELECT ST_AsEWKT(ST_PatchN(geom, 2)) As geomewkt
FROM (
VALUES (ST_GeomFromEWKT('POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),
((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),
((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)),
((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )')) ) As foo(geom);
geomewkt
---+-----------------------------------------
POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))