This topic describes the ST_GeometryN function. This function returns the Nth geometry of an input geometry.

Syntax

meshgeom ST_NumGeometries(meshgeom geom, integer index );
meshgeom ST_NumGeometries(sfmesh sfmeshObject, integer index );

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshObjectThe sfmesh object.
indexThe sequence number of the geometry that you want to obtain. The value of this parameter starts from 0.

Description

The function returns the Nth geometry of an input geometry.

Examples

select ST_AsText(ST_GeometryN('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1), INDEX((0,1,2),(1,2,3)))))'::meshgeom, 0));

------------------------------------------------------------------------------
 MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))