All Products
Search
Document Center

ApsaraDB RDS:ST_pointN

Last Updated:Mar 28, 2026

Returns the nth pcpoint from a pcpatch using 1-based indexing, where negative values count from the end of the patch.

Syntax

pcpoint ST_pointN(pcpatch pc, integer n);

Parameters

ParameterDescription
pcThe pcpatch object.
nThe 1-based position of the pcpoint to return. Negative values count from the end: -1 returns the last point, -2 returns the second-to-last, and so on.

Examples

Return the 4th point from the patch where id = 7:

SELECT ST_asText(ST_pointN(pa, 4)) FROM patches WHERE id = 7;

Output:

{"pcid":1,"pt":[-126.41,45.59,59,5]}