Appearance
ST_POINTN
Returns the Nth point in a single linestring. Negative values are counted backwards from the end of the line, so that -1 is the last point.
See also:
Syntax
sql
ST_POINTN(<linestring>, <n>)
Arguments
<input>
: TheLINESTRING
object<n>
:INTEGER
indicating which point to return
Returns
Returns a GEOGRAPHY
point that is the Nth point in the linestring. Returns NULL
if input is not of LINESTRING
type, or index is invalid.
Example
sql
SELECT ST_AsText(ST_POINTN('LINESTRING(0 0, 1 1, 2 2)'::GEOGRAPHY, 2));
-- POINT(1 1)