ST_POINTN
functionsupportedCore SQL functionsReturns a Point at a specified index in a LineString.
Syntax
ST_POINTN( <geography_or_geometry_expression> , <index> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_or_geometry_expression | required | The argument must be an expression of type GEOGRAPHY or GEOMETRY that represents a LineString. |
index | required | The index of the Point to return. The index must be an integer. A negative index is interpreted as the offset from the end of the LineString. For example, -1 is interpreted as the last Point in the LineString, -2 is interpreted as the second to the last Point, etc. |
Returns
The function returns a value of type GEOGRAPHY or GEOMETRY that contains the Point at the specified index of the LineString.
Usage notes
- If geography_or_geometry_expression is not a LineString, the function reports an error.
- If index is out of bounds (e.g. exceeds the number of Points in the LineString), the function reports an error.