This topic describes the ST_PatchN function. If the input geometry object is a polyhedral surface or polyhedral surfacem object, this function returns the Nth plane of the input object. The index number starts from 1. In other cases, this function returns NULL.

Syntax

geometry  ST_PatchN(geometry  geomA , integer  n);

Parameters

Parameter Description
geomA The geometry object that you want to specify.
n The index number.

Description

  • If you want to extract all geometry objects of the input geometry object, we recommend that you use the ST_Dump function, which is more efficient.
  • This function supports polyhedral surfaces.
  • This function supports 3D objects and does not delete z coordinates.

Examples

SELECT ST_AsText(ST_PatchN('POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 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,1));
                  st_astext
---------------------------------------------
 POLYGON Z ((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0))
(1 row)