Categories:

Geospatial functions

ST_STARTPOINT

Returns the first Point in a LineString.

See also:

ST_ENDPOINT , ST_POINTN

Syntax

ST_STARTPOINT( <geography_or_geometry_expression> )
Copy

Arguments

geography_or_geometry_expression

The argument must be an expression of type GEOGRAPHY or GEOMETRY that represents a LineString.

Returns

The function returns a value of type GEOGRAPHY or GEOMETRY that contains the first Point of the specified LineString.

Usage notes

  • If geography_or_geometry_expression is not a LineString, the function reports an error.

Examples

GEOGRAPHY examples

The following query returns the first Point in a LineString:

ALTER SESSION SET GEOGRAPHY_OUTPUT_FORMAT='WKT';
SELECT ST_STARTPOINT(TO_GEOGRAPHY('LINESTRING(1 1, 2 2, 3 3, 4 4)'));

+---------------------------------------------------------------+
| ST_STARTPOINT(TO_GEOGRAPHY('LINESTRING(1 1, 2 2, 3 3, 4 4)')) |
|---------------------------------------------------------------|
| POINT(1 1)                                                    |
+---------------------------------------------------------------+
Copy

GEOMETRY examples

The following query returns the first Point in a LineString:

ALTER SESSION SET GEOMETRY_OUTPUT_FORMAT='WKT';
SELECT ST_STARTPOINT(TO_GEOMETRY('LINESTRING(1 1, 2 2, 3 3, 4 4)'));

+--------------------------------------------------------------+
| ST_STARTPOINT(TO_GEOMETRY('LINESTRING(1 1, 2 2, 3 3, 4 4)')) |
|--------------------------------------------------------------|
| POINT(1 1)                                                   |
+--------------------------------------------------------------+
Copy
Language: English