GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
temporal.h File Reference
#include <grass/datetime.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
Include dependency graph for temporal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _tgisMap
 
struct  _tgisMapList
 List of tgisMap struct's. More...
 
struct  _tgisExtent
 
struct  _tgisDatasetList
 List of tgisDatasets struct's. More...
 
struct  _tgisDataset
 

Macros

#define TGISDB_DEFAULT_DRIVER   "sqlite"
 
#define TGISDB_DEFAULT_SQLITE_PATH   "tgis/sqlite.db"
 
#define TGIS_TYPE_MAP   0
 
#define TGIS_TYPE_STDS   1
 
#define TGIS_RASTER_MAP   1
 
#define TGIS_RASTER3D_MAP   2
 
#define TGIS_VECTOR_MAP   3
 
#define TGIS_STRDS   4
 
#define TGIS_STR3DS   5
 
#define TGIS_STVDS   6
 
#define TGIS_ABSOLUTE_TIME   0
 
#define TGIS_RELATIVE_TIME   1
 

Typedefs

typedef struct _tgisMap tgisMap
 
typedef struct _tgisMapList tgisMapList
 List of tgisMap struct's. More...
 
typedef struct _tgisExtent tgisExtent
 
typedef struct _tgisDatasetList tgisDatasetList
 List of tgisDatasets struct's. More...
 
typedef struct _tgisDataset tgisDataset
 

Functions

int tgis_set_connection (dbConnection *connection)
 Set Temporal GIS DB connection settings. More...
 
int tgis_get_connection (dbConnection *connection)
 Get Temporal GIS DB connection settings. More...
 
const char * tgis_get_default_driver_name (void)
 Get default TGIS driver name. More...
 
char * tgis_get_default_database_name (void)
 Get default TGIS database name for the sqlite connection. More...
 
char * tgis_get_driver_name (void)
 Get TGIS driver name. More...
 
char * tgis_get_database_name (void)
 Get TGIS database name. More...
 
char * tgis_get_mapset_driver_name (const char *)
 Get TGIS driver name from a specific mapset. More...
 
char * tgis_get_mapset_database_name (const char *)
 Get TGIS database name. More...
 
int tgis_set_default_connection (void)
 Sets up TGIS database connection settings using GRASS default. More...
 
void tgis_init_map_list (tgisMapList *list)
 Init a tgisMapList and free allocated memory. More...
 
void tgis_free_map_list (tgisMapList *list)
 Free allocated memory of an integer list. More...
 
tgisMapListtgis_new_map_list (void)
 Return a new integer list. More...
 
void tgis_map_list_insert (tgisMapList *list, char *name, char *mapset, struct TimeStamp *ts)
 Insert map information into tgisMapList. More...
 
void tgis_map_list_add (tgisMapList *list, tgisMap *map)
 Add a map to tgisMapList. More...
 
void tgis_init_dataset_list (tgisDatasetList *list)
 
void tgis_free_dataset_list (tgisDatasetList *list)
 
tgisDatasetListtgis_new_dataset_list (void)
 
void tgis_dataset_list_insert (tgisDatasetList *list, char *name, char *mapset, char *creator, DateTime *creation_time, char temporal_type, struct TimeStamp *ts, tgisExtent *extent, void *metadata, char dataset_type, char is_stds)
 
void tgis_dataset_list_add (tgisDataset *dataset)
 
int tgis_build_topology (tgisDatasetList *A, char spatial)
 
int tgis_build_topology2 (tgisDatasetList *A, tgisDatasetList *B, char spatial)
 
int tgis_create_stds (char *stds_name, char stds_type, char temporal_type, char *title, char *description, char *semantic_type, char *aggregation_type)
 
int tgis_modify_stds (char *stds_name, char stds_type, char *title, char *description, char *semantic_type, char *aggregation_type)
 
int tgis_remove_stds (char *stds_name, char stds_type, char remove_maps)
 
int tgis_update_stds (char *stds_name, char stds_type)
 
int tgis_register_map (tgisMap *map, char map_type, char *stds_name)
 
int tgis_unregister_map (tgisMap *map, char map_type, char *stds_name)
 
int tgis_register_maps (tgisMapList *list, char map_type, char *stds_name)
 
int tgis_unregister_maps (tgisMapList *list, char map_type, char *stds_name)
 
tgisDatasetListtgis_get_registered_maps (char *stds_name, char *mapset, char stds_type, char *order, char *where)
 
tgisDatasetListtgis_get_registered_stds (char *stds_name, char *mapset, char stds_type, char temporal_type, char *order, char *where)
 
tgisDatasettgis_get_stds_info (char *stds_name, char *mapset, char stds_type)
 

Macro Definition Documentation

◆ TGIS_ABSOLUTE_TIME

#define TGIS_ABSOLUTE_TIME   0

Definition at line 38 of file temporal.h.

◆ TGIS_RASTER3D_MAP

#define TGIS_RASTER3D_MAP   2

Definition at line 32 of file temporal.h.

◆ TGIS_RASTER_MAP

#define TGIS_RASTER_MAP   1

Definition at line 31 of file temporal.h.

◆ TGIS_RELATIVE_TIME

#define TGIS_RELATIVE_TIME   1

Definition at line 39 of file temporal.h.

◆ TGIS_STR3DS

#define TGIS_STR3DS   5

Definition at line 35 of file temporal.h.

◆ TGIS_STRDS

#define TGIS_STRDS   4

Definition at line 34 of file temporal.h.

◆ TGIS_STVDS

#define TGIS_STVDS   6

Definition at line 36 of file temporal.h.

◆ TGIS_TYPE_MAP

#define TGIS_TYPE_MAP   0

Definition at line 28 of file temporal.h.

◆ TGIS_TYPE_STDS

#define TGIS_TYPE_STDS   1

Definition at line 29 of file temporal.h.

◆ TGIS_VECTOR_MAP

#define TGIS_VECTOR_MAP   3

Definition at line 33 of file temporal.h.

◆ TGISDB_DEFAULT_DRIVER

#define TGISDB_DEFAULT_DRIVER   "sqlite"

Definition at line 8 of file temporal.h.

◆ TGISDB_DEFAULT_SQLITE_PATH

#define TGISDB_DEFAULT_SQLITE_PATH   "tgis/sqlite.db"

Definition at line 10 of file temporal.h.

Typedef Documentation

◆ tgisDataset

typedef struct _tgisDataset tgisDataset

A dataset structure to organize time stamped maps and space time datasets and their spatio-temporal topological relations.

◆ tgisDatasetList

List of tgisDatasets struct's.

This structure is used to store lists of dataset (space time datasets or time stamped maps) using the tgisDataset structure internally.

◆ tgisExtent

typedef struct _tgisExtent tgisExtent

Spatio temporal extent as double values

The spatio temporal extent contains only double values.

The unit of start and end time is seconds in case the time is absolute. Reference is Jan. 1. 1900 00:00:00 +00:00 UTC

If no end time is present, because its a time instance, then has_end must be 0.

◆ tgisMap

typedef struct _tgisMap tgisMap

A simple structure to organize time stamped maps

◆ tgisMapList

typedef struct _tgisMapList tgisMapList

List of tgisMap struct's.

This structure is used to store lists of time stamped maps using the tgisMap structure internally.

Function Documentation

◆ tgis_build_topology()

int tgis_build_topology ( tgisDatasetList A,
char  spatial 
)

Build the temporal or spatio-temporal topology of the provided dataset list

◆ tgis_build_topology2()

int tgis_build_topology2 ( tgisDatasetList A,
tgisDatasetList B,
char  spatial 
)

Build the temporal or spatio-temporal topology between the two dataset list

◆ tgis_create_stds()

int tgis_create_stds ( char *  stds_name,
char  stds_type,
char  temporal_type,
char *  title,
char *  description,
char *  semantic_type,
char *  aggregation_type 
)

Create the new space time dataset

◆ tgis_dataset_list_add()

void tgis_dataset_list_add ( tgisDataset dataset)

Add a new dataset to the dataset list

◆ tgis_dataset_list_insert()

void tgis_dataset_list_insert ( tgisDatasetList list,
char *  name,
char *  mapset,
char *  creator,
DateTime creation_time,
char  temporal_type,
struct TimeStamp ts,
tgisExtent extent,
void *  metadata,
char  dataset_type,
char  is_stds 
)

Insert a new dataset to the dataset list

◆ tgis_free_dataset_list()

void tgis_free_dataset_list ( tgisDatasetList list)

◆ tgis_free_map_list()

void tgis_free_map_list ( tgisMapList list)

Free allocated memory of an integer list.

Parameters
listThe pointer to an integer list

Definition at line 28 of file map_list.c.

References G_free().

◆ tgis_get_connection()

int tgis_get_connection ( dbConnection connection)

Get Temporal GIS DB connection settings.

Parameters
[out]connectionpointer to dbConnection to be modified
Returns
DB_OK

Definition at line 78 of file temporal/lib/connect.c.

References _db_connection::databaseName, DB_OK, _db_connection::driverName, G_getenv_nofatal2(), G_VAR_MAPSET, and G_zero().

◆ tgis_get_database_name()

char* tgis_get_database_name ( void  )

Get TGIS database name.

Returns
pointer to TGIS database name
NULL if not set

Definition at line 41 of file temporal/lib/connect.c.

References G_getenv_nofatal2(), G_store(), G_VAR_MAPSET, and NULL.

◆ tgis_get_default_database_name()

char* tgis_get_default_database_name ( void  )

Get default TGIS database name for the sqlite connection.

The default name is $GISDBASE/$LOCATION_NAME/$MAPSET/tgis/sqlite.db

Returns
pointer to default TGIS database name

Definition at line 40 of file temporal/lib/default_name.c.

References G_store(), and TGISDB_DEFAULT_SQLITE_PATH.

◆ tgis_get_default_driver_name()

const char* tgis_get_default_driver_name ( void  )

Get default TGIS driver name.

Returns
pointer to default TGIS driver name

Definition at line 28 of file temporal/lib/default_name.c.

References TGISDB_DEFAULT_DRIVER.

◆ tgis_get_driver_name()

char* tgis_get_driver_name ( void  )

Get TGIS driver name.

Returns
pointer to TGIS driver name
NULL if not set

Definition at line 25 of file temporal/lib/connect.c.

References G_getenv_nofatal2(), G_store(), G_VAR_MAPSET, and NULL.

◆ tgis_get_mapset_database_name()

char* tgis_get_mapset_database_name ( const char *  mapset)

Get TGIS database name.

This function give a warning in case the mapset does not exists or it is not allowed to access the mapset. NULL is returned in this case..

Parameters
mapsetThe name of the mapset to receive the driver name from
Returns
pointer to TGIS database name
NULL if not set

Definition at line 168 of file temporal/lib/connect.c.

◆ tgis_get_mapset_driver_name()

char* tgis_get_mapset_driver_name ( const char *  mapset)

Get TGIS driver name from a specific mapset.

This function give a warning in case the mapset does not exists or it is not allowed to access the mapset. NULL is returned in this case.

Parameters
mapsetThe name of the mapset to receive the driver name from
Returns
pointer to TGIS driver name
NULL if not set

Definition at line 152 of file temporal/lib/connect.c.

◆ tgis_get_registered_maps()

tgisDatasetList* tgis_get_registered_maps ( char *  stds_name,
char *  mapset,
char  stds_type,
char *  order,
char *  where 
)

Get all maps that are registered in a space time dataset

◆ tgis_get_registered_stds()

tgisDatasetList* tgis_get_registered_stds ( char *  stds_name,
char *  mapset,
char  stds_type,
char  temporal_type,
char *  order,
char *  where 
)

Get all stds from the temporal database

◆ tgis_get_stds_info()

tgisDataset* tgis_get_stds_info ( char *  stds_name,
char *  mapset,
char  stds_type 
)

Get the information about a specific space time dataset from the temporal database

◆ tgis_init_dataset_list()

void tgis_init_dataset_list ( tgisDatasetList list)

◆ tgis_init_map_list()

void tgis_init_map_list ( tgisMapList list)

Init a tgisMapList and free allocated memory.

Parameters
listThe pointer to a tgisMapList

Definition at line 69 of file map_list.c.

References G_free(), and NULL.

Referenced by tgis_new_map_list().

◆ tgis_map_list_add()

void tgis_map_list_add ( tgisMapList list,
tgisMap map 
)

Add a map to tgisMapList.

Add a new map to the map list

This function adds a tgisMap to the list but does not check for duplicates. In case reallocation fails, G_fatal_error() will be invoked by the allocation function.

The content of the map will not be copied, the pointer to the map will be stored.

Parameters
listThe tgisMapList pointer
mapA pointer to a tgisMap struct that should be added

Definition at line 103 of file map_list.c.

References G_realloc.

◆ tgis_map_list_insert()

void tgis_map_list_insert ( tgisMapList list,
char *  name,
char *  mapset,
struct TimeStamp ts 
)

Insert map information into tgisMapList.

Insert a new map to the map list

This function allocates a tgisMap, fills it with the provided information and adds it to the list. In case allocation fails, G_fatal_error() will be invoked by the allocation function.

All arguments are deep copied to the new allocated tgisMap struct.

Parameters
listThe tgisMapList pointer
nameThe name of the map
mapsetThe name of the mapset
tsA pointer to the timestamp of the map

Definition at line 133 of file map_list.c.

◆ tgis_modify_stds()

int tgis_modify_stds ( char *  stds_name,
char  stds_type,
char *  title,
char *  description,
char *  semantic_type,
char *  aggregation_type 
)

Modify the metadata of an existing space time dataset

◆ tgis_new_dataset_list()

tgisDatasetList* tgis_new_dataset_list ( void  )

◆ tgis_new_map_list()

tgisMapList* tgis_new_map_list ( void  )

Return a new integer list.

G_fatal_error() will be invoked by the allocation function.

Returns
list The pointer to a new allocated integer list

Definition at line 54 of file map_list.c.

References G_malloc, list, NULL, and tgis_init_map_list().

◆ tgis_register_map()

int tgis_register_map ( tgisMap map,
char  map_type,
char *  stds_name 
)

Register a map in the temporal database and optionally in a space time dataset

◆ tgis_register_maps()

int tgis_register_maps ( tgisMapList list,
char  map_type,
char *  stds_name 
)

Register maps in the temporal database and optionally in a space time dataset

◆ tgis_remove_stds()

int tgis_remove_stds ( char *  stds_name,
char  stds_type,
char  remove_maps 
)

Remove a space time dataset and optionally all of its maps

◆ tgis_set_connection()

int tgis_set_connection ( dbConnection connection)

Set Temporal GIS DB connection settings.

This function sets environmental variables as TGISDB_DRIVER, TGISDB_DATABASE.

Parameters
connectionpointer to dbConnection with default settings
Returns
DB_OK

Definition at line 60 of file temporal/lib/connect.c.

References _db_connection::databaseName, DB_OK, _db_connection::driverName, G_setenv2(), and G_VAR_MAPSET.

◆ tgis_set_default_connection()

int tgis_set_default_connection ( void  )

Sets up TGIS database connection settings using GRASS default.

Returns
returns DB_OK

Definition at line 55 of file temporal/lib/default_name.c.

◆ tgis_unregister_map()

int tgis_unregister_map ( tgisMap map,
char  map_type,
char *  stds_name 
)

Unregister a map from the temporal database or optionally from a space time dataset

◆ tgis_unregister_maps()

int tgis_unregister_maps ( tgisMapList list,
char  map_type,
char *  stds_name 
)

Unregister maps from the temporal database or optionally from a space time dataset

◆ tgis_update_stds()

int tgis_update_stds ( char *  stds_name,
char  stds_type 
)