Name

ST_StartPoint — Returns the first point of a LINESTRING geometry as a POINT.

Synopsis

geometry ST_StartPoint(geometry geomA);

Description

Returns the first point of a LINESTRING geometry as a POINT or NULL if the input parameter is not a LINESTRING.

This method implements the SQL/MM specification: SQL-MM 3: 7.1.3

This function supports 3d and will not drop the z-index.

Examples

SELECT ST_AsText(ST_StartPoint('LINESTRING(0 1, 0 2)'::geometry));
 st_astext
------------
 POINT(0 1)
(1 row)

SELECT ST_StartPoint('POINT(0 1)'::geometry) IS NULL AS is_null;
  is_null
----------
 t
(1 row)

--3d line
SELECT ST_AsEWKT(ST_StartPoint('LINESTRING(0 1 1, 0 2 2)'::geometry));
 st_asewkt
------------
 POINT(0 1 1)
(1 row)

See Also

ST_EndPoint, ST_PointN