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 3, Temporal Types, the bounding box associated to a temporal type depends on the base type: It is the period type for the tbool and ttext types, the tbox type for the tint and tfloat types, and the stbox type for the tgeompoint and tgeogpoint types. Furthermore, as seen in the section called “Casting”, many PostgreSQL, PostGIS, or MobilityDB types can be cast to the tbox and stbox types. For example, numeric and range types can be casted to type tbox, types geometry and geography can be casted to type stbox, and time types and temporal types can be casted 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.

Another set of operators consider the relative position of the bounding boxes. The operators <<, >>, &<, and &> consider the value dimension for tint 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 allow to mix 2D/3D geometries but in that case, the computation is only performed on 2D.

We refer to the section called “Topological Operators” and the section called “Relative Position Operators” for the bounding box operators.