ST_PointN()¶
TL;DR¶
Use ST_PointN() to retrieve a one-based point from a LINESTRING.
Returns the point at a one-based position in a line geometry.
Syntax¶
ST_PointN(geom, n)
Arguments¶
Argument |
Description |
|---|---|
|
A |
|
The one-based point position ( |
Return Value¶
Returns the same geometry precision type as geom.
Usage Notes¶
Examples¶
DROP DATABASE IF EXISTS geo_accessor_demo;
CREATE DATABASE geo_accessor_demo;
USE geo_accessor_demo;
SELECT ST_AsText(ST_PointN(ST_GeomFromText('LINESTRING(7 8,9 10,11 12)'), 2)) AS point_n;
DROP DATABASE geo_accessor_demo;