| 1 | = Adding the time dimension to GRASS GIS raster, vector and voxel data types for field based applications using a time stamp approach = |
| 2 | |
| 3 | == Time stamps in SQL tables == |
| 4 | |
| 5 | Raster, vector and voxel maps in GRASS GIS will have temporal attributes by default: |
| 6 | * Creation time |
| 7 | * Modification time |
| 8 | * An absolute or relative time stamp |
| 9 | * absolute: |
| 10 | * start date |
| 11 | * end date |
| 12 | * relative |
| 13 | * a relative time stamp |
| 14 | |
| 15 | 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. |
| 16 | |
| 17 | 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. |
| 18 | |
| 19 | 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: |
| 20 | |
| 21 | * The '''base table''' has an equal layout for raster, vector and raster3d maps. This table stores: |
| 22 | * 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 |
| 23 | * The '''temporal type''' specifies if the time stamp is relative or absolute |
| 24 | * The '''creation date''' is of type datetime |
| 25 | * The '''modification date''' is of type datetime |
| 26 | |
| 27 | * 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: |
| 28 | * The '''id''' as primary key |
| 29 | * The '''start time stamp''' is of type datetime |
| 30 | * The '''end time stamp'''is of type datetime |
| 31 | * The '''time zone'''is of type integer |
| 32 | |
| 33 | * 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: |
| 34 | * The '''id''' as primary key |
| 35 | * The '''relative time stamp''' is of type datetime |
| 36 | |
| 37 | A map can only have an absolute or relative time stamp. |
| 38 | |
| 39 | * 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, ...) |
| 40 | |
| 41 | In long term these kind of SQL tables may replace the text file based storage of map metadata, database links and time stamps. |
| 42 | |
| 43 | == New temporal GRASS datatypes == |
| 44 | |
| 45 | 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. |
| 46 | |
| 47 | 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) |
| 48 | Spacetime datasets have absolute or relative time type, these types cant be mixed up but converted. |
| 49 | |
| 50 | 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). |
| 51 | |
| 52 | 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. |
| 53 | |
| 54 | === Raster spacetime datasets === |
| 55 | |
| 56 | The raster spacetime datasets store raster map specific attributes and metadata: |
| 57 | * The spatial extent (e, w, n, s) |
| 58 | * The temporal extent (start and end time or duration) |
| 59 | * The data range (min and max) |
| 60 | * The raster datatype (CELL, FCELL, DCELL, MIXED) |
| 61 | |
| 62 | All these table entries are computed or updated via trigger from all registered raster maps when maps are added or removed. |
| 63 | |
| 64 | Table layout: |
| 65 | |
| 66 | The base spacetime tables are equal to the raster/vector and raster3d one. |
| 67 | |
| 68 | * '''Spacetime metadata raster table''' |
| 69 | * '''id''' the name of the spacetime raster table |
| 70 | * '''temporal type''' relative or absolute |
| 71 | * '''Raster register table name''' the name of the table storing the ids (names) of all registered raster maps |
| 72 | * '''spatial extent''' (4 columns: e, w, s,n) of all registered raster maps |
| 73 | * '''temporal exten'''t of all registered raster maps |
| 74 | * '''data range''' of all registered raster maps |
| 75 | * ... |
| 76 | |
| 77 | === Raster3d spacetime datasets === |
| 78 | |
| 79 | The raster3d spacetime tables are equal to the raster spacetime tablse, except that the spatial extent is computed based on east, west, south, north, top and bottom. |
| 80 | |
| 81 | === Vector spacetime datasets === |
| 82 | |
| 83 | |
| 84 | == New temporal modules == |
| 85 | |
| 86 | New temporal modules must be implemented for registration and un-registration and extraction of raster, voxel and vector maps in süacetime datasets: |
| 87 | * tr.register, tr.unregister, tr.extract |
| 88 | * t3.register, t3.unregister, t3.extract |
| 89 | * tv.register, tv.unregister, tv.extract |
| 90 | * Spacetime modules for resampling, interpolation, time stamp snapping and extraction must be implemented. |
| 91 | |
| 92 | == Basic Spatio-temporal algorithms == |
| 93 | |
| 94 | Extraction is based on where SQL statements or specific time stamps. Interpolated maps are created or existing map ids will be returned. |
| 95 | The extraction tool will provide different types of extraction algorithms |
| 96 | Nearest neighbour |
| 97 | Interpolation (only raster and voxel maps) (linear, quadratic, ...) or |
| 98 | first valid time stamp. |
| 99 | |
| 100 | |
| 101 | tr(3).resample -> will create a new spacetime raster (voxel) datasets with a different spatio-temporal resolution, several methods will be available: |
| 102 | * averaging (mean, median, geometric mean, ...) |
| 103 | * summation, multiplication |
| 104 | * max and min functions |
| 105 | |
| 106 | == Implementation details == |
| 107 | |
| 108 | Access to spacetime tables must be implemented as GRASS GIS library: |
| 109 | * Registration and unregistration of maps into spacetime datasets |
| 110 | * Update/creation of base table entries, so the SQL tables can be modified in low level GRASS GIS library functions (creation, deletion of maps) |
| 111 | * Selection of maps from spacetime datasets |