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: Int)
Return type: Geometry
SQL example:
SELECT ST_GeometryN(ST_GeomFromText('MULTIPOINT((1 2), (3 4), (5 6), (8 9))'), 2)
Output: POINT (3 4)