- Categories:
ST_ POINTN¶
Returns a Point at a specified index in a LineString.
- See also:
Syntax¶
Arguments¶
geography_or_geometry_expressionThe argument must be an expression of type GEOGRAPHY or GEOMETRY that represents a LineString.
indexThe 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,
-1is interpreted as the last Point in the LineString,-2is 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_expressionis not a LineString, the function reports an error. - If
indexis out of bounds (e.g. exceeds the number of Points in the LineString), the function reports an error.
Examples¶
GEOGRAPHY examples¶
The following query returns the second Point in a LineString:
The following query uses a negative index to return the second Point from the end of a LineString:
GEOMETRY examples¶
The following query returns the second Point in a LineString:
The following query uses a negative index to return the second Point from the end of a LineString: