ST_GeometryN¶
Introduction: Return the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING, MULTICURVE or (MULTI)POLYGON. Otherwise, return null
Note
Since v2.0.0, n is 1-based, as in PostGIS: n = 1 returns the first geometry, and 0 or a negative n returns null. Earlier versions read n 0-based.
Format: ST_GeometryN(geom: Geometry, n: Integer)
Return type: Geometry
Since: v1.3.0
Example:
SELECT ST_GeometryN(ST_GeomFromText('MULTIPOINT((1 2), (3 4), (5 6), (8 9))'), 2)
Output:
POINT (3 4)