User's Guide and Reference

ST_StartPoint

ST_StartPoint takes a linestring and returns a point that is the linestrings first point.

Syntax

db2gse.ST_StartPoint(c db2gse.ST_Curve)

Return type

db2gse.ST_Point

Examples

The following CREATE TABLE statement creates the STARTPOINT_TEST table. STARTPOINT_TEST has two columns: the GID integer column, which uniquely identifies the rows of the table, and the LN1 linestring column.

CREATE TABLE STARTPOINT_TEST (gid integer, ln1 db2gse.ST_LineString) 

The following INSERT statements insert the linestrings into the LN1 column. The first linestring does not have Z coordinates or measures, while the second linestring has both.

INSERT INTO STARTPOINT_TEST VALUES(1,
db2gse.ST_LineFromText('linestring (10.02 20.01,23.73 
21.92,30.10 40.23)', db2gse.coordref()..srid(0)))
 
INSERT INTO STARTPOINT_TEST VALUES(2,
db2gse.ST_LineFromText('linestring  zm (10.02 20.01 5.0 7.0,23.73 21.92 6.5 7.1,30.10
40.23 6.9 7.2)', db2gse.coordref()..srid(0))) 

The following SELECT statement and the corresponding result set shows how the ST_StartPoint function extracts the first point of each linestring. The ST_AsText function converts the point to its text format. The first point in the list does not have a Z coordinate or a measure, while the second point has both because the source linestring did.

SELECT gid, CAST(db2gse.ST_AsText(db2gse.ST_StartPoint (ln1)) as varchar(60)) 
"Startpoint"
FROM STARTPOINT_TEST
 
GID         Startpoint
----------- ------------------------------------------------------------
          1 POINT ( 10.02000000 20.01000000)
          2 POINT ZM ( 10.02000000 20.01000000 5.00000000 7.00000000)
 
  2 record(s) selected. 


[ Top of Page | Previous Page | Next Page ]