ST_PatchN
Name
ST_PatchN — Returns the Nth face of a PolyhedralSurface or TIN.
Synopsis
geometry
ST_PatchN
(
geometry
geomA
, integer
n
)
;
Description
Returns the 1-based Nth face of a PolyhedralSurface or TIN. Returns NULL for other geometries or an out-of-range index. Use this function to access faces, because ST_GeometryN treats PolyhedralSurface and TIN as unitary geometries.
|
|
|
Index is 1-based. |
|
|
|
If you want to extract all elements of a geometry ST_Dump is more efficient. |
Availability: 2.0.0
This method implements the SQL/MM specification.
SQL-MM ISO/IEC 13249-3: 8.5
This function supports 3d and will not drop the z-index.
This function supports Polyhedral surfaces.
This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).
Examples
Extract the 2nd face of the polyhedral surface.
SELECT ST_PatchN(geom, 2) As geomewkt
FROM (
VALUES ('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)) )'::geometry) ) As foo(geom);
POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))
See Also
ST_AsEWKT , ST_GeomFromEWKT , ST_Dump , ST_GeometryN , ST_NumGeometries , ST_NumPatches