Bounding Box Operators

These operators test whether the bounding boxes of their arguments satisfy the predicate and result in a Boolean value. As stated in Chapter 4, Temporal Types (Part 1), the bounding box associated to a temporal type depends on the base type: It is the tstzspan type for the tbool, ttext, and tjsonb types, the tbox type for the tint, tbigint, and tfloat types, and the stbox type for the tgeompoint and tgeogpoint types. Furthermore, as seen in the section called “Conversions”, many PostgreSQL, PostGIS, or MobilityDB types can be converted to the tbox and stbox types. For example, numeric and span types can be converted to type tbox, types geometry and geography can be converted to type stbox, and time types and temporal types can be converted to types tbox and stbox.

A first set of operators consider the topological relationships between the bounding boxes. There are five topological operators: overlaps (&&), contains (@>), contained (<@), same (~=), and adjacent (-|-). The arguments of these operators can be a base type, a box, or a temporal type and the operators verify the topological relationship taking into account the value and/or the time dimension depending on the type of the arguments. They read the bounding box of a temporal value, not the value: whether the value itself lies in a box at some instant, or at every instant, is tested by the ever and always overlaps ?&& and %&& (???).

Another set of operators consider the relative position of the bounding boxes. The operators <<, >>, &<, and &> consider the value dimension for the tint, tbigint, and tfloat types and the X coordinates for the tgeompoint and tgeogpoint types, the operators <<|, |>>, &<|, and |&> consider the Y coordinates for the tgeompoint and tgeogpoint types, the operators <</, />>, &</, and /&> consider the Z coordinates for the tgeompoint and tgeogpoint types, and the operators <<#, #>>, #&<, and #&> consider the time dimension for all temporal types.

Finally, it is worth noting that the bounding box operators read the dimensions both operands have, see the section called “Operands of Different Dimensions”.

We refer to the section called “Bounding Box Operations” for the bounding box operators.