Geometric Functions
Somewhat unique among popular RDBMSs, PostgreSQL provides an extensive set of geometric-oriented functions. These functions and their associated operators are useful when performing calculations on spatial-related data sets.
AREA
Description
The AREA function computes the area occupied by a given object.
Input
AREA(obj)
Example
AREA(box '((1,1),(3,3))') → 4
BOX
Description
There are several versions of the BOX function. Most perform conversions from other geometric types to the box data type. However, if the BOX function is passed two overlapping boxes, the result will be a box that represents where the intersection occurs.
Inputs
BOX(box,box)—Perform an intersection.
BOX(circle)— Convert a circle to a box.
BOX(point,point) ...
Get PostgreSQL Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.