ST_PointN¶
Returns the Nth point in a linestring.
Usage¶
geometry ST_PointN(geom: geometry, n: integer)
Arguments¶
- geom (geometry): Input geometry
- n (integer)
Description¶
Return the Nth point in a single linestring. Negative values are counted backwards from the end of the LineString such that -1 is the last point. Returns NULL if there is no linestring in the geometry.
Examples¶
SELECT ST_PointN(ST_GeomFromText('LINESTRING(0 0, 1 2, 2 4, 3 6)'), 2);
┌─────────────────────────────────────────────────────────────────────────────┐
│ st_pointn(st_geomfromtext(Utf8("LINESTRING(0 0, 1 2, 2 4, 3 6)")),Int64(2)) │
│ geometry │
╞═════════════════════════════════════════════════════════════════════════════╡
│ POINT(1 2) │
└─────────────────────────────────────────────────────────────────────────────┘