ST_PointN¶
Introduction: Return the Nth point in a single linestring or circular linestring in the geometry. Negative values are counted backwards from the end of the LineString, so that -1 is the last point. Returns NULL if there is no linestring in the geometry.
Format: ST_PointN(A: Geometry, B: Integer)
Since: v1.2.1
Examples:
SELECT ST_PointN(df.geometry, 2)
FROM df
Input: LINESTRING(0 0, 1 2, 2 4, 3 6), 2
Output: POINT (1 2)
Input: LINESTRING(0 0, 1 2, 2 4, 3 6), -2
Output: POINT (2 4)
Input: CIRCULARSTRING(1 1, 1 2, 2 4, 3 6, 1 2, 1 1), -1
Output: POINT (1 1)