Definition
ST_StartPoint returns the first point of a linestring.
Syntax
Oracle and PostgreSQL
sde.st_startpoint (ln1 sde.st_geometry)
SQLite
st_startpoint (ln1 geometryblob)
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.
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.
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
CREATE TABLE startpoint_test (
gid integer,
ln1 sde.st_geometry
);
INSERT INTO STARTPOINT_TEST VALUES (
1,
sde.st_linefromtext ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 4326)
);
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)', 4326)
);
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
CREATE TABLE startpoint_test (
gid serial,
ln1 sde.st_geometry
);
INSERT INTO startpoint_test (ln1) VALUES (
sde.st_linestring ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 4326)
);
INSERT INTO startpoint_test (ln1) VALUES (
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)', 4326)
);
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)
SQLite
CREATE TABLE startpoint_test (
gid integer primary key autoincrement not null
);
SELECT AddGeometryColumn(
NULL,
'startpoint_test',
'ln1',
4326,
'linestringzm',
'xyzm',
'null'
);
INSERT INTO startpoint_test (ln1) VALUES (
st_linestring ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 4326)
);
INSERT INTO startpoint_test(ln1) VALUES (
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)', 4326)
);
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)