-- 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 ST_LineString); -- 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. INSERT INTO startpoint_test VALUES( 1, ST_LineFromText('linestring (10.02 20.01,23.73 21.92,30.10 40.23)', 1000) ); INSERT INTO startpoint_test VALUES( 2, 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)', 1000) ); -- The ST_StartPoint function extracts the first point of each ST_LineString. -- The first point in the list doesn't have a Z coordinate or a measure -- while the second point has both because the source linestring does. SELECT gid, ST_StartPoint(ln1) Startpoint FROM startpoint_test;