12345678910111213141516171819202122232425262728 |
- -- The pointn_test table is created with the gid column,
- -- which uniquely identifies each row, and the ln1 ST_LineString column.
- CREATE TABLE pointn_test (gid integer,
- ln1 ST_LineString);
- -- The INSERT statements insert two linestring values.
- -- The first linestring doesn't have Z coordinates or measures,
- -- while the second linestring has both.
- INSERT INTO pointn_test VALUES(
- 1,
- ST_LineFromText('linestring (10.02 20.01,23.73 21.92,30.10 40.23)',1000)
- );
- INSERT INTO pointn_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 query lists the gid column and the second vertex of each linestring.
- -- The first row results in a ST_Point without a Z coordinate or measure,
- -- while the second row results in a ST_Point with a Z coordinate and a
- -- measure. The ST_PointN function will also include a Z coordinate or
- -- measure value if they exist in the source linestring.
- SELECT gid, ST_PointN(ln1,2) the_2nd_vertex
- FROM pointn_test;
|