Returns the start point of a LineString or circular LineString. Returns NULL for any other geometry type.
Syntax
geometry ST_StartPoint(geometry geomA)Parameters
| Parameter | Description |
|---|---|
geomA | The geometry object. |
Usage notes
Preserves z coordinates — 3D geometries are supported and z values are not dropped.
Supports circular strings and curves, not just standard LineStrings.
Examples
Start point of a LineString
SELECT ST_AsText(ST_StartPoint('LINESTRING(0 0,2 2)'::geometry));Result:
st_astext
------------
POINT(0 0)
(1 row)Start point of a non-LineString is NULL
SELECT ST_StartPoint('POINT(0 1)'::geometry) IS NULL AS is_null;Result:
is_null
----------
t
(1 row)Start point of a 3D LineString
SELECT ST_AsEWKT(ST_StartPoint('LINESTRING(0 1 1, 0 2 2)'::geometry));Result:
st_asewkt
------------
POINT(0 1 1)
(1 row)Start point of a CircularString
SELECT ST_AsText(ST_StartPoint('CIRCULARSTRING(5 2,-3 1.999999, -2 1, -4 2, 6 3)'::geometry));Result:
st_astext
------------
POINT(5 2)
(1 row)See also
ST_EndPoint: Returns the last point of a LineString.
ST_PointN: Returns the Nth point of a LineString.
该文章对您有帮助吗?