t.vect.algebra(1)
NAME πΈ
okay bestie, welcome to t.vect.algebra(1) straight out of the GRASS GIS User's Manual π (and heads up, this is part 1 of 2, so we're not even done yet).
t.vect.algebraβ Apply temporal and spatial operations on space time vector datasets using temporal vector algebra.
KEYWORDS π
temporal, algebra, vector, time β yeah it's exactly the vibe you think it is π
SYNOPSIS β¨
t.vect.algebra
t.vect.algebra --help
t.vect.algebra [-s] expression=expression basename=basename [--help] [--verbose] [--quiet] [--ui]
Flags π©
-sβ Check the spatial topology of temporally related maps and process only spatially related maps.--helpβ Print usage summary.--verboseβ Verbose module output.--quietβ Quiet module output.--uiβ Force launching GUI dialog.
Parameters π§
expression=expression[required] β Spatio-temporal mapcalc expression.basename=basename[required] β Basename of the new generated output maps. A numerical suffix separated by an underscore will be attached to create a unique identifier.
DESCRIPTION π
so t.vect.algebra does temporal AND spatial overlay and buffer functions on space time vector datasets (STVDS) β by using the temporal vector algebra. you can straight up create brand new STVDS that are literally expressions of the STVDS you already have. it's giving "make it make sense but make it math" π
The module expects an expression as input parameter in the following form:
"result = expression"
The statement structure is similar to r.mapcalc, see r.mapcalc. Where result represents the name of a space time dataset (STVDS) that will contain the result of the calculation that is given as expression on the right side of the equality sign. These expression can be any valid or nested combination of temporal operations and functions that are provided by the temporal vector algebra.
The algebra provides methods for map selection from STDS based on their temporal relations. It is also possible to temporally shift maps, to create temporal buffer and to snap time instances to create a valid temporal topology. Furthermore expressions can be nested and evaluated in conditional statements (if, else statements). Within if-statements the algebra provides temporal variables like start time, end time, day of year, time differences or number of maps per time interval to build up conditions. These operations can be assigned to space time datasets or to the results of operations between space time datasets.
As default, topological relationships between space time datasets will be evaluated only temporal. Use the s flag to activate the additionally spatial topology evaluation. π
The expression option must be passed as quoted expression, for example:
t.select expression="C = A : B"
Where C is the new space time raster dataset that will contain maps from A that are selected by equal temporal relationships to the existing dataset B in this case.
TEMPORAL VECTOR ALGEBRA π¦
The temporal algebra provides a wide range of temporal operators and functions that will be presented in the following section. buckle up, bestie, there's a lot and it's all iconic π
TEMPORAL RELATIONS β
Several temporal topology relations between registered maps of space time datasets are supported:
equals A ------
B ------
during A ----
B ------
contains A ------
B ----
starts A ----
B ------
started A ------
B ----
finishes A ----
B ------
finished A ------
B ----
precedes A ----
B ----
follows A ----
B ----
overlapped A ------
B ------
overlaps A ------
B ------
over booth overlaps and overlapped
The relations must be read as: A is related to B, like:
- A equals B
- A is during B
- A contains B
Topological relations must be specified in {} parentheses. don't forget the curly braces or it's over for you fr fr π
TEMPORAL OPERATORS π₯
The temporal algebra defines temporal operators that can be combined with other operators to perform spatio-temporal operations. The temporal operators process the time instances and intervals of two temporal related maps and calculate the result temporal extent by five different possibilities.
- LEFT REFERENCE β
lβ Use the time stamp of the left space time dataset - INTERSECTION β
iβ Intersection - DISJOINT UNION β
dβ Disjoint union - UNION β
uβ Union - RIGHT REFERENCE β
rβ Use the time stamp of the right space time dataset
TEMPORAL SELECTION π
The temporal selection simply selects parts of a space time dataset without processing raster or vector data. The algebra provides a selection operator : that selects parts of a space time dataset that are temporally equal to parts of a second one by default. The following expression
C = A : B
means: Select all parts of space time dataset A that are equal to B and store it in space time dataset C. The parts are time stamped maps.
In addition the inverse selection operator !: is defined as the complement of the selection operator, hence the following expression
C = A !: B
means: select all parts of space time time dataset A that are not equal to B and store it in space time dataset (STDS) C.
To select parts of a STDS by different topological relations to other STDS, the temporal topology selection operator can be used. The operator consists of the temporal selection operator, the topological relations, that must be separated by the logical OR operator | and the temporal extent operator. All three parts are separated by comma and surrounded by curly braces:
{"temporal selection operator", "topological relations", "temporal operator"}
Examples:
C = A {:, equals} B
C = A {!:, equals} B
We can now define arbitrary topological relations using the OR operator "|" to connect them:
C = A {:,equals|during|overlaps} B
Select all parts of A that are equal to B, during B or overlaps B.
In addition we can define the temporal extent of the result STDS by adding the temporal operator.
C = A {:, during,r} B
Select all parts of A that are during B and use the temporal extents from B for C.
The selection operator is implicitly contained in the temporal topology selection operator, so that the following statements are exactly the same:
C = A : B
C = A {:} B
C = A {:,equal} B
C = A {:,equal,l} B
Same for the complementary selection:
C = A !: B
C = A {!:} B
C = A {!:,equal} B
C = A {!:,equal,l} B
CONDITIONAL STATEMENTS π
Selection operations can be evaluated within conditional statements. Note A and B can either be space time datasets or expressions. The temporal relationship between the conditions and the conclusions can be defined at the beginning of the if statement. The relationship between then and else conclusion must be always equal.
if(if, then, else)β the whole shape of the thingif(conditions, A)βAif conditions are True; temporal topological relation betweenifandthenis equal.if(conditions, A, B)βAif conditions are True,Botherwise; temporal topological relation betweenif,thenandelseis equal.if(topologies, conditions, A)βAif conditions are True; temporal topological relation betweenifandthenis explicit specified by topologies.if(topologies, conditions, A, B)βAif conditions are True,Botherwise; temporal topological relation betweenif,thenandelseis explicit specified by topologies.
Logical operators π
==β equal!=β not equal>β greater than>=β greater than or equal<β less than<=β less than or equal&&β and||β or
Temporal functions π§
The following temporal function are evaluated only for the STDS that must be given in parenthesis.
td(A)β Returns a list of time intervals of STDSAstart_time(A)β Start time asHH::MM:SSstart_date(A)β Start date asyyyy-mm-DDstart_datetime(A)β Start datetime asyyyy-mm-DD HH:MM:SSend_time(A)β End time asHH:MM:SSend_date(A)β End date asyyyy-mm-DDend_datetime(A)β End datetime asyyyy-mm-DD HH:MMstart_doy(A)β Day of year (doy) from the start time[1 - 366]start_dow(A)β Day of week (dow) from the start time[1 - 7], the start of the week is Monday == 1start_year(A)β The year of the start time[0 - 9999]start_month(A)β The month of the start time[1 - 12]start_week(A)β Week of year of the start time[1 - 54]start_day(A)β Day of month from the start time[1 - 31]start_hour(A)β The hour of the start time[0 - 23]start_minute(A)β The minute of the start time[0 - 59]start_second(A)β The second of the start time[0 - 59]end_doy(A)β Day of year (doy) from the end time[1 - 366]end_dow(A)β Day of week (dow) from the end time[1 - 7], the start of the week is Monday == 1end_year(A)β The year of the end time[0 - 9999]end_month(A)β The month of the end time[1 - 12]end_week(A)β Week of year of the end time[1 - 54]end_day(A)β Day of month from the start time[1 - 31]end_hour(A)β The hour of the end time[0 - 23]end_minute(A)β The minute of the end time[0 - 59]end_second(A)β The second of the end time[0 - 59]
β¨ Comparison operator β¨
The conditions are comparison expressions, and they're literally the vibe check for space time datasets π . Specific values of temporal variables get compared by logical operators and evaluated for each map of the STDS and the related maps. For complex relations the comparison operator can be used to combine conditions:
The structure is similar to the select operator but with an extra glow-up: an aggregation operator:
{"comparison operator", "topological relations", aggregation operator, "temporal operator"}
This aggregation operator (| or &) defines the behaviour if a map is related to more than one map, e.g. for the topological relations 'contains'. Should all (&) conditions for the related maps be true, or is it sufficient to have any (|) condition that is true? The resulting boolean value is then compared to the first condition by the comparison operator (|| or &&). As default the aggregation operator is related to the comparison operator:
Comparison operator -> aggregation operator:
|| -> | and && -> &
Examples, bestie, take notes π:
Condition 1 {||, equal, r} Condition 2
Condition 1 {&&, equal|during, l} Condition 2
Condition 1 {&&, equal|contains, |, l} Condition 2
Condition 1 {&&, equal|during, l} Condition 2 && Condition 3
Condition 1 {&&, equal|during, l} Condition 2 {&&,contains, |, r} Condition 3
π’ Hash operator π’
Additionally the number of maps in intervals can be computed and used in conditional statements with the hash (#) operator. It's giving math girlie πβ¨
A{#, contains}B
This expression computes the number of maps from space time dataset B which are during the time intervals of maps from space time dataset A. A list of integers (scalars) corresponding to the maps of A that contain maps from B will be returned.
C = if({equal}, A {#, contains} B > 2, A {:, contains} B)
This expression selects all maps from A that temporally contains at least 2 maps from B and stores them in space time dataset C. The leading equal statement in the if condition specifies the temporal relation between the if and then part of the if expression. This is very important, so we do not need to specify a global time reference (a space time dataset) for temporal processing π
Furthermore the temporal algebra allows temporal buffering, shifting and snapping with the functions buff_t(), tshift() and tsnap() respectively.
buff_t(A, size) Buffer STDS A with granule ("1 month" or 5)
tshift(A, size) Shift STDS A with granule ("1 month" or 5)
tsnap(A) Snap time instances and intervals of STDS A
π Single map with temporal extent π
The temporal algebra can also handle single maps with time stamps in the tmap function. Main character behaviour, honestly π
tmap()
For example:
C = A {:,during} tmap(event)
This statement select all maps from space time data set A that are during the temporal extent of single map 'event'.
πΊοΈ Spatial vector operators πΊοΈ
The module supports the following boolean vector operations:
- AND β
&β Intersection β precedence1β (v.overlay operator=and) - OR β
|β Union β precedence1β (v.overlay operator=or) - DISJOINT OR β
+β Disjoint union β precedence1β (v.patch) - XOR β
^β Symmetric difference β precedence1β (v.overlay operator=xor) - NOT β
~β Complement β precedence1β (v.overlay operator=not)
And vector functions π§:
buff_p(A, size)β Buffer the points of vector map layer A with sizebuff_l(A, size)β Buffer the lines of vector map layer A with sizebuff_a(A, size)β Buffer the areas of vector map layer A with size
𧬠Combinations of temporal, vector and select operators π§¬
We combine the temporal topology relations, the temporal operators and the spatial/select operators to create spatio-temporal vector operators:
{"spatial or select operator" , "list of temporal relations", "temporal operator" }
For multiple topological relations or several related maps the spatio-temporal operators feature implicit aggregation. The algebra evaluates the stated STDS by their temporal topologies and apply the given spatio temporal operators in a aggregated form. If we have two STDS A and B, B has three maps: b1, b2, b3 that are all during the temporal extent of the single map a1 of A, then the following overlay calculations would implicitly aggregate all maps of B into one result map for a1 of A:
C = A {&, contains} B --> c1 = a1 & b1 & b2 & b3
Keep attention that the aggregation behaviour is not symmetric π¨:
C = B {&, during} A --> c1 = b1 & a1
c2 = b2 & a1
c3 = b3 & a1
π Examples: π
Spatio-temporal intersect all maps from space time dataset A with all maps from space time dataset B which have equal time stamps and are temporary before Jan. 1. 2005 and store them in space time dataset D.
D = if(start_date(A) < "2005-01-01", A & B)
Buffer all vector points from space time vector dataset A and B with a distance of one and intersect the results with overlapping, containing, during and equal temporal relations to store the result in space time vector dataset D with intersected time stamps.
D = buff_p(A, 1) {&,overlaps|overlapped|equal|during|contains,i} buff_p(B, 1)
Select all maps from space time dataset B which are during the temporal buffered space time dataset A with a map interval of three days, else select maps from C and store them in space time dataset D.
D = if(contains, td(buff_t(A, "1 days")) == 3, B, C)
π REFERENCES π
PLY(Python-Lex-Yacc)
π SEE ALSO π
t.select
π AUTHORS π
Thomas Leppelt, Soeren Gebbert, ThΓΌnen Institute of Climate-Smart Agriculture
π«Ά SOURCE CODE π«Ά
Available at: t.vect.algebra source code (history)
Accessed: Saturday Jan 17 05:41:54 2026
Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
And that's the whole page, bestie β no cap π you just readGRASS 8.4.2t.vect.algebra(1)front to back and you ate π β¨ slay, go buffer something π
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms