stds_tables_template.sql 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --#############################################################################
  2. -- This SQL script generates the space time dataset tables to store time
  3. -- stamps and revision for SQL queries and temporal GIS support.
  4. --
  5. -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
  6. --#############################################################################
  7. -- STDS is a placeholder for specific space-time dataset type: strds, str3ds, stvds
  8. CREATE TABLE STDS_base (
  9. id VARCHAR NOT NULL, -- Id of the space-time dataset, name@mapset this is the primary key
  10. name VARCHAR NOT NULL, -- name of the space-time dataset
  11. mapset VARCHAR NOT NULL, -- mapset of the space-time dataset
  12. creator VARCHAR NOT NULL, -- Name of the creator
  13. temporal_type VARCHAR NOT NULL, -- The temporal type of the dataset "absolute" or "relative"
  14. semantic_type VARCHAR NOT NULL, -- The semantic data description used for aggregation/decomposition algorithm selection: min, max, mean or sum
  15. creation_time TIMESTAMP NOT NULL, -- The time of creation of the space-time dataset
  16. modification_time TIMESTAMP NOT NULL,-- The time of the last modification of the space time dataset
  17. PRIMARY KEY (id)
  18. );
  19. CREATE TABLE STDS_relative_time (
  20. id VARCHAR NOT NULL, -- Id of the space-time dataset, this is the primary key
  21. start_time INTEGER, -- The relative valid start time
  22. end_time INTEGER, -- The relative valid end time
  23. granularity INTEGER, -- The granularity
  24. unit VARCHAR, -- The relative time unit, available are "years, months, days, minutes, seconds"
  25. map_time VARCHAR, -- The temporal type of the registered maps, may be interval, point or mixed
  26. PRIMARY KEY (id)
  27. );
  28. CREATE TABLE STDS_absolute_time (
  29. id VARCHAR NOT NULL, -- Id of the space-time dataset, this is the primary key
  30. start_time TIMESTAMP, -- Start of the valid time, can be NULL if no map is registered
  31. end_time TIMESTAMP, -- End of the valid time, can be NULL if no map is registered
  32. granularity VARCHAR, -- The granularity "NNN seconds, NNN minutes, NNN hours, NNN days, NNN months, NNN years"
  33. map_time VARCHAR, -- The temporal type of the registered maps, may be interval, point or mixed
  34. PRIMARY KEY (id)
  35. );
  36. CREATE TABLE STDS_spatial_extent (
  37. id VARCHAR NOT NULL, -- Id of the space-time dataset, this is the primary key
  38. north DOUBLE PRECISION, -- The spatial north extent, derived from the registered maps
  39. south DOUBLE PRECISION, -- The spatial south extent, derived from the registered maps
  40. east DOUBLE PRECISION, -- The spatial east extent, derived from the registered maps
  41. west DOUBLE PRECISION, -- The spatial west extent, derived from the registered maps
  42. top DOUBLE PRECISION, -- The spatial top extent, derived from the registered maps
  43. bottom DOUBLE PRECISION, -- The spatial bottom extent, derived from the registered maps
  44. proj VARCHAR, -- The projection of the space time dataset (XY of LL)
  45. PRIMARY KEY (id)
  46. );