A ST_StartPoint
Definition
ST_StartPoint returns the first point of a linestring.
Syntax
sde.st_startpoint (ln1 sde.st_geometry)
Return type
ST_Point
Examples
The startpoint_test table is created with the gid integer column, which uniquely identifies the rows of the table, and the ln1 ST_LineString column.
CREATE TABLE startpoint_test (gid integer, ln1 sde.st_geometry);
The INSERT statements insert the ST_LineStrings into the ln1 column. The first ST_LineString does not have z-coordinates or measures, while the second ST_LineString has both.
Oracle
INSERT INTO STARTPOINT_TEST VALUES ( 1, sde.st_linefromtext ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 0) ); INSERT INTO STARTPOINT_TEST VALUES ( 2, sde.st_linefromtext ('linestring zm(10.02 20.01 5 7, 23.73 21.92 6.5 7.1, 30.10 40.23 6.9 7.2)', 0) );
PostgreSQL
INSERT INTO startpoint_test VALUES ( 1, sde.st_linestring ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 0) ); INSERT INTO startpoint_test VALUES ( 2, sde.st_linestring ('linestring zm(10.02 20.01 5 7, 23.73 21.92 6.5 7.1, 30.10 40.23 6.9 7.2)', 0) );
The ST_StartPoint function extracts the first point of each ST_LineString. The first point in the list does not have a z-coordinate or measure, while the second point has both, because the source linestring does.
Oracle
SELECT gid, sde.st_astext (sde.st_startpoint (ln1)) Startpoint FROM STARTPOINT_TEST; GID Startpoint 1 POINT (10.02000000 20.01000000) 2 POINT ZM (10.02000000 20.01000000 5.00000000 7.00000000)
PostgreSQL
SELECT gid, sde.st_astext (sde.st_startpoint (ln1)) AS Startpoint FROM startpoint_test; gid startpoint 1 POINT (10.02000000 20.01000000) 2 POINT ZM (10.02000000 20.01000000 5.00000000 7.00000000)
2/5/2013