st_x.sql 679 B

123456789101112131415161718192021222324
  1. -- The x_test table is created with two columns: the gid column,
  2. -- which uniquely identifies the row, and the pt1 point column.
  3. CREATE TABLE x_test (gid integer,
  4. pt1 ST_Point);
  5. -- The INSERT statements insert two rows.
  6. -- One is a point without a Z coordinate or a measure.
  7. -- The other row has both a Z coordinate and a measure.
  8. INSERT INTO x_test VALUES(
  9. 1,
  10. ST_PointFromText('point (10.02 20.01)', 1000)
  11. );
  12. INSERT INTO x_test VALUES(
  13. 2,
  14. ST_PointFromText('point zm (10.02 20.01 5.0 7.0)', 1000)
  15. );
  16. -- The query lists the gid column and the double-precision X coordinate of the points.
  17. SELECT gid, ST_X(pt1) x_coord
  18. FROM x_test;