The following operators compare the spatiotemporal bounding box of temporal cells rather than containment in the cell hierarchy. tcell is a spatial temporal type: its bounding box is an stbox that combines the spatial extent of the cell boundaries (their longitude/latitude envelope in SRID 4326), geodetic for an H3 or S2 cell and planar for a QUADBIN cell, with the trajectory's tstzspan time period. The operators below compare that box along the spatial and/or temporal axes. See the indexing section for the opclasses that make these operators index-capable.
The @> operator tests spatiotemporal bounding-box containment (spatial extent and time together), not containment in the cell hierarchy. To test whether one cell is the ancestor of another at a given resolution, use cellToParent.
Return the spatiotemporal bounding box of a temporal cell, or that box expanded in the spatial dimension by a float value
stbox(tcell) → stbox expandSpace(tcell,float) → stbox
The box is the envelope of the cell boundaries, geodetic for an H3 or S2 cell and planar for a QUADBIN cell, together with the trajectory's time period, so it is the key both index operator classes of the indexing section store.
SELECT round(stbox(th3index '871fa44a8ffffff@2001-01-01'), 6); /* SRID=4326;GEODSTBOX XT(((4.280027,50.79295),(4.314775,50.815648)), [2001-01-01, 2001-01-01]) */ SELECT round(expandSpace(th3index '871fa44a8ffffff@2001-01-01', 1), 6); /* SRID=4326;GEODSTBOX XT(((3.280027,49.79295),(5.314775,51.815648)), [2001-01-01, 2001-01-01]) */ SELECT round(stbox(tquadbin '48a6227affffffff@2001-01-01'), 6); /* SRID=4326;STBOX XT(((4.21875,50.736455),(4.570313,50.958427)), [2001-01-01, 2001-01-01]) */ SELECT round(expandSpace(tquadbin '48a6227affffffff@2001-01-01', 1), 6); /* SRID=4326;STBOX XT(((3.21875,49.736455),(5.570313,51.958427)), [2001-01-01, 2001-01-01]) */ SELECT round(stbox(ts2cell '47c3c@2001-01-01'), 6); /* SRID=4326;GEODSTBOX XT(((3.780069,50.590023),(4.676786,51.283168)), [2001-01-01, 2001-01-01]) */ SELECT round(expandSpace(ts2cell '47c3c@2001-01-01', 1), 6); /* SRID=4326;GEODSTBOX XT(((2.780069,49.590023),(5.676786,52.283168)), [2001-01-01, 2001-01-01]) */
Topological operators
{tstzspan,stbox,tcell} {&&, <@, @>, ~=, -|-} {tstzspan,stbox,tcell} → boolean
Bounding-box overlap, contains, contained-by, same, and adjacent
SELECT th3index '871fa44a8ffffff@2001-01-01' && tstzspan '[2001-01-01, 2001-01-02]'; -- t SELECT th3index '871fa44a8ffffff@2001-01-01' ~= th3index '871fa44a8ffffff@2001-01-01'; -- t SELECT tquadbin '485623ffffffffff@2001-01-01' && tstzspan '[2001-01-01, 2001-01-02]'; -- t SELECT tquadbin '485623ffffffffff@2001-01-01' ~= tquadbin '485623ffffffffff@2001-01-01'; -- t SELECT ts2cell '47c3c@2001-01-01' && tstzspan '[2001-01-01, 2001-01-02]'; -- t SELECT ts2cell '47c3c@2001-01-01' ~= ts2cell '47c3c@2001-01-01'; -- t
Position operators
{stbox,tcell} {<<, &<, >>, &>} {stbox,tcell} → boolean
{stbox,tcell} {<<|, &<|, |>>, |&>} {stbox,tcell} → boolean
{tstzspan,stbox,tcell} {<<#, &<#, #>>, #&>} {tstzspan,stbox,tcell} → boolean
Relative position along the spatial axes (strictly-left, overlaps-left, overlaps-right, strictly-right; strictly-below, overlaps-below, overlaps-above, strictly-above) and along the time axis (strictly-before, overlaps-before, strictly-after, overlaps-after)
SELECT th3index '871fa44a8ffffff@2001-01-01' << th3index '871fa44aeffffff@2001-01-01'; -- f SELECT tquadbin '485623ffffffffff@2001-01-01' << tquadbin '48b6227abfffffff@2001-01-01'; -- f SELECT ts2cell '47c3c@2001-01-01' << ts2cell '47c4@2001-01-01'; -- f
SELECT th3index '871fa44a8ffffff@2001-01-01' <<# th3index '871fa44aeffffff@2001-01-05'; -- t SELECT th3index '871fa44a8ffffff@2001-01-01' #>> th3index '871fa44aeffffff@2001-01-05'; -- f SELECT tquadbin '485623ffffffffff@2001-01-01' <<# tquadbin '48b6227abfffffff@2001-01-05'; -- t SELECT tquadbin '485623ffffffffff@2001-01-01' #>> tquadbin '48b6227abfffffff@2001-01-05'; -- f SELECT ts2cell '47c3c@2001-01-01' <<# ts2cell '47c4@2001-01-05'; -- t SELECT ts2cell '47c3c@2001-01-01' #>> ts2cell '47c4@2001-01-05'; -- f