wiki:Grass7/TemporalExtension

Adding the time dimension to GRASS GIS raster, vector and voxel data types for field based applications using a snap shot approach

The basic idea is to store time stamps for raster, raster3d and vector data into datetime capable SQL database tables to allow temporal queries and to establish new spatio-temporal data types for simple and effective time series handling of raster, raster3d and vector maps. The new datatypes are named spacetime raster, spacetime raster3d and spacetime raster3d datasets. Raster, raster3d and vector maps can be registered in the spacetime datasets. Specific modules for temporal extraction and resampling will be implemented for the spacetime datasets.

Time stamps in SQL tables

Raster, vector and voxel maps in GRASS GIS will have temporal attributes by default:

  • Creation time
  • Modification time
  • An absolute or relative time stamp
    • absolute:
      • start date
      • end date
    • relative
      • start value
      • end value

To store the time stamps and to enable temporal queries a SQL DBMS, capable of temporal datatypes, will be used. As default a Sqlite3 database will be used to store map specific informations in database files. Additionally Postgresql should be supported too.

In case of SQlite a GRASS SQL database file is created for each mapset in a location. Views are used to access the raster, vector or raster3d map entries of different mapset databases at once.

The time stamps as well as attributes and map specific meta data of all created maps in GRASS GIS will be stored in SQL tables in the GRASS SQL databases. The entries in the SQL tables will be created or updated automatically while creation, modification or removement of maps. For each GRASS datatype (raster, raster3d and vector) four SQL tables will be added to GRASS SQL databases at mapset creation:

  • The base table has an equal layout for raster, vector and raster3d maps. This table stores:
    • The id which is of type string. As id the raster, raster3d or vector map names should be used, because these must be unique in a mapset and can be used as primary key
    • The temporal type specifies if the time stamp is relative or absolute
    • The creation date is of type datetime
    • The modification date is of type datetime
  • The absolute time table to store the absolute time stamps for each map. The layout is equal for raster, raster3d and vector maps. This table stores:
    • The id as primary key
    • The start time stamp is of type datetime
    • The end time stampis of type datetime
    • The time zoneis of type integer
  • The relative time table to store the relative time stamps for each map. The layout is equal for raster, raster3d and vector maps. This table stores:
    • The id as primary key
    • The relative time stamp is of type datetime

A map can only have an absolute or relative time stamp.

  • The metadata table is specific for each grass data type. It stores the spatial and temporal extent as well as map specific attributes (creator, range, cell type, features, registered spacetime datasets, ...)

In long term these kind of SQL tables may replace the text file based storage of map metadata, database links and time stamps.

New temporal GRASS datatypes

To manage temporal raster, raster3d and vector objects, three new datatypes will be added to GRASS GIS: Spacetime raster, vector and voxel datasets. Additionally thematic spatio-temporal datasets will be added to handle thematic related spacetime datasets of different type.

Maps can be registered and unregistered in spacetime datasets. Maps are registered by id (name). All available spatio-temporal data is availabe in SQL tables. Cross referencing must be implemented (maps storing the spacetime datasets in which they are registered and vis versa) Spacetime datasets have absolute or relative time type, these types cant be mixed up but converted.

A temporal resolution can be set for each spacetime dataset (1s - decades) defining the granularity of the datasets (like the resolution settings for raster/voxel maps).

The new spacetime datasets are handled like raster or vector maps. They are registered in mapset specific tables with creation and modification date and absolute/relative time stamp.

Spacetime raster datasets

The spacetime raster datasets have specific attribute which derived from the registered raster maps:

  • The temporal type (absolute, relative)
  • The spatial extent computed from all registered raster maps (e, w, n, s)
  • The temporal extent computed from all registered raster maps (start and end time or duration)
  • The data range computed from all registered raster maps (min and max)
  • The min and max NS resolution computed from all registered raster maps
  • The min and max EW resolution computed from all registered raster maps
  • The raster datatype (CELL, FCELL, DCELL, MIXED)
  • temporal resolution

All these table entries are computed or updated via trigger from all registered raster maps when maps are added or removed.

Table layout:

The base and absolute/relative time spacetime tables are equal to the raster/vector and raster3d one.

  • Spacetime metadata raster table
    • id the name of the spacetime raster table
    • Raster register table name the name of the table storing the ids (names) of all registered raster maps
    • spatial extent (4 columns: e, w, s,n) of all registered raster maps
    • data range min, max of all registered raster maps (2 columns)
    • Min Max resolution the min and max NS and EW resolution (4 columns)
    • ...

Spacetime raster3d datasets

The spacetime raster3d tables are equal to the raster spacetime tables, except that the spatial extent is computed based on east, west, south, north, top and bottom.

Spacetime vector datasets

The spacetime vector datasets have specific attribute which derived from the registered vector maps:

  • The temporal type (absolute, relative)
  • The spatial extent computed from all registered vector maps (e, w, n, s)
  • The temporal extent computed from all registered vector maps (start and end time or duration)
  • The number of features computed from all registered vector maps (min and max)
  • temporal resolution

All these table entries are computed or updated via trigger from all registered vector maps when maps are added or removed.

Table layout:

The base and absolute/relative time spacetime tables are equal to the raster/vector and raster3d one.

  • Spacetime metadata raster table
    • id the name of the spacetime vector table
    • Vector register table name the name of the table storing the ids (names) of all registered vector maps
    • spatial extent (4 columns: e, w, s, n) of all registered vector maps
    • ...

New temporal modules

New temporal modules must be implemented for registration and un-registration of raster, voxel and vector maps in spacetime datasets:

  • tr.register, tr.unregister, tr.extract
  • t3.register, t3.unregister, t3.extract
  • tv.register, tv.unregister, tv.extract

Spacetime modules for resampling, interpolation and time stamp snapping must be implemented.

Basic Spatio-temporal algorithms

Extraction is based on where SQL statements or specific time stamps. Internally a temporal rtree will be created to store temporal ordered maps. Interpolated maps are created or existing map ids will be returned. The extraction tool will provide different types of extraction algorithms:

  • Nearest neighbour
  • Interpolation (only raster and voxel maps) (linear, quadratic, ...) or
  • first/last valid time stamp.

tr(3).resample -> will create a new spacetime raster (voxel) datasets with a different spatio-temporal resolution, several methods will be available:

  • averaging (mean, median, geometric mean, ...)
  • summation, multiplication
  • max and min functions

Example: resampling allows to create weekly, monthly , seasonal or yearly aggregation of daily data

Implementation details

Access to spacetime tables must be implemented as GRASS GIS library:

  • Registration and unregistration of maps into spacetime datasets
  • Update/creation of base table entries, so the SQL tables can be modified in low level GRASS GIS library functions (creation, deletion of maps)
  • Selection of maps from spacetime datasets
Last modified 8 years ago Last modified on Oct 24, 2011 6:39:59 AM