ST_StartPoint returns the first point of a linestring.
Oraclesde.st_startpoint (ln1 sde.st_geometry)
PostgreSQL
st_startpoint (ln1 st_geometry)
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.
Oracle
CREATE TABLE startpoint_test (gid integer, ln1 sde.st_geometry);
PostgreSQL
CREATE TABLE startpoint_test (gid integer, ln1 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,
st_linestring ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 0)
);
INSERT INTO startpoint_test VALUES (
2,
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, st_astext (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)