ST_GeometryN¶
Returns the 0-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING, MULTICURVE or (MULTI)POLYGON.
Usage¶
geometry ST_GeometryN(geom: geometry, n: integer)
Arguments¶
- geom (geometry): Input geometry
- n (integer)
Description¶
Returns NULL if the index is out of range.
Examples¶
SELECT ST_GeometryN(
ST_GeomFromText('MULTIPOINT((1 2), (3 4), (5 6), (8 9))'),
1
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_geometryn(st_geomfromtext(Utf8("MULTIPOINT((1 2), (3 4), (5 6), (8 9))")) │
│ ,Int64(1))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2) │
└──────────────────────────────────────────────────────────────────────────────┘