ST_StartPoint function

The ST_StartPoint function takes a curve as an input parameter and returns the point that is the first point of the curve.

The resulting point is represented in the spatial reference system of the given curve. This result is equivalent to the function call ST_PointN(curve, 1)

If the given curve is null or is empty, then null is returned.

This function can also be called as a method.

Syntax

Read syntax diagramSkip visual syntax diagramdb2gse.ST_StartPoint(curve)

Parameters

curve
A value of type ST_Curve or one of its subtypes that represents the geometry from which the first point is returned.

Return type

db2gse.ST_Point

Example

In the following example, two linestrings are added to the SAMPLE_LINES table. The first one is a linestring with X and Y coordinates. The second one is a linestring with X, Y, and Z coordinates. The ST_StartPoint function is used to return the first point in each linestring.

SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_lines (id INTEGER, line ST_LineString)

INSERT INTO sample_lines
  VALUES (1, ST_LineString ('linestring 
         (10 10, 5 5, 0 0, 10 0, 5 5, 0 10)', 0))

INSERT INTO sample_lines
  VALUES (1, ST_LineString ('linestring z 
         (0 0 4, 5 5 5, 10 10 6, 5 5 7, 0 0 8)', 0))

SELECT id, CAST( ST_AsText( ST_StartPoint( line ) ) AS VARCHAR(80))
  START_POINT
  FROM sample_lines
Results:

ID          START_POINT
----------- --------------------------------------------
          1 POINT ( 10.00000000 10.00000000)
          2 POINT Z ( 0.00000000 0.00000000 4.00000000)