User's Guide and Reference

ST_Endpoint

ST_Endpoint takes a linestring and returns a point that is the linestring's last point.

Syntax

db2gse.ST_Endpoint(c db2gse.ST_Curve)

Return type

db2gse.ST_Point

Examples

The ENDPOINT_TEST table stores the GID integer column that uniquely identifies each row and the LN1 linestring column that stores linestrings.

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

The INSERT statements insert linestrings into the ENDPOINT_TEST table. The first one does not have Z coordinates or measures; the second one does.

INSERT INTO ENDPOINT_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 ENDPOINT_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 lists the GID column with the output of the ST_Endpoint function. The ST_Endpoint function generates a point geometry that is converted to text by the ST_AsText function. The CAST function is used to shorten the default varchar(4000) value of the ST_AsText function to a varchar(60).

SELECT gid, CAST(db2gse.ST_AsText(db2gse.ST_Endpoint(ln1)) AS varchar(60)) "Endpoint"
FROM ENDPOINT_TEST

The following result set is returned.

GID         Endpoint
----------- ------------------------------------------------------------
          1 POINT ( 30.10000000 40.23000000)
          2 POINT ZM ( 30.10000000 40.23000000 7.00000000 7.20000000)
 
  2 record(s) selected.


[ Top of Page | Previous Page | Next Page ]