Aller au contenu

Renvoie le Point situé à un index donné dans un LineString.

ST_POINTN(<geometry>, <index>)
Arguments Description
<geometry> L’argument doit être une expression de type GEOMETRY qui représente un LineString.
<index> L’index du Point à renvoyer.

Geometry.

SELECT
ST_POINTN(
ST_GEOMETRYFROMWKT(
'LINESTRING(1 1, 2 2, 3 3, 4 4)'
),
1
) AS pipeline_pointn;
┌─────────────────┐
│ pipeline_pointn │
├─────────────────┤
│ POINT(1 1) │
└─────────────────┘
SELECT
ST_POINTN(
ST_GEOMETRYFROMWKT(
'LINESTRING(1 1, 2 2, 3 3, 4 4)'
),
-2
) AS pipeline_pointn;
┌─────────────────┐
│ pipeline_pointn │
├─────────────────┤
│ POINT(3 3) │
└─────────────────┘