st_endpoint.sql 891 B

1234567891011121314151617181920212223242526
  1. -- The endpoint_test table stores the gid integer column, which uniquely
  2. -- identifies each row and the ln1 ST_LineString column that stores
  3. -- linestrings.
  4. CREATE TABLE endpoint_test (gid integer,
  5. ln1 ST_LineString);
  6. -- The INSERT statements insert linestrings into the endpoint_test table.
  7. -- The first linestring doesn't have Z coordinates or measures,
  8. -- while the second one does.
  9. INSERT INTO endpoint_test VALUES(
  10. 1,
  11. ST_LineFromText('linestring (10.02 20.01,23.73 21.92,30.10 40.23)',1000)
  12. );
  13. INSERT INTO endpoint_test VALUES(
  14. 2,
  15. 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)
  16. );
  17. -- The query lists the gid column with the output of the ST_EndPoint function.
  18. -- The ST_EndPoint function generates a ST_Point geometry.
  19. SELECT gid, ST_EndPoint(ln1) Endpoint
  20. FROM endpoint_test;