st_coorddim.sql 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. -- The coorddim_test table is created with the columns, geotype and g1.
  2. -- The geotype column stores the name of the geometry subclass stored in
  3. -- the g1 ST_Geometry column.
  4. CREATE TABLE coorddim_test (geotype varchar(20),
  5. g1 ST_Geometry);
  6. -- The INSERT statements insert a sample of various subclasses
  7. -- into the coorddim_test table.
  8. INSERT INTO coorddim_test VALUES(
  9. 'Point',
  10. ST_PointFromText('point (10.02 20.01)',1000)
  11. );
  12. INSERT INTO coorddim_test VALUES(
  13. 'Point',
  14. ST_PointFromText('point z (10.02 20.01 3.21)',1000)
  15. );
  16. INSERT INTO coorddim_test VALUES(
  17. 'LineString',
  18. ST_LineFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)',1000)
  19. );
  20. INSERT INTO coorddim_test VALUES(
  21. 'LineString',
  22. ST_LineFromText('linestring m (10.02 20.01 1.23, 10.32 23.98 4.56, 11.92 25.64 7.89)',1000)
  23. );
  24. INSERT INTO coorddim_test VALUES(
  25. 'Polygon',
  26. ST_PolyFromText('polygon ((10.02 20.01,11.92 35.64,25.02 34.15,19.15 33.94, 10.02 20.01))',1000)
  27. );
  28. INSERT INTO coorddim_test VALUES(
  29. 'Polygon',
  30. ST_PolyFromText('polygon zm ((10.02 20.01 9.87 1.23, 11.92 35.64 7.65 2.34, 25.02 34.15 6.54 3.45, 19.15 33.94 5.43 4.56, 10.02 20.01 9.87 1.23))',1000)
  31. );
  32. -- The SELECT statement lists the subclass name stored in the
  33. -- geotype column with the dimension of that geotype.
  34. SELECT geotype, ST_CoordDim(g1) coord_dimension
  35. FROM coorddim_test;