Unsupported versions: 6.5
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

# Geometric Operators

Table 4-4. Postgres Geometric Operators

Operator Description Usage
+ Translation '((0,0),(1,1))'::box + '(2.0,0)'::point
- Translation '((0,0),(1,1))'::box - '(2.0,0)'::point
* Scaling/rotation '((0,0),(1,1))'::box * '(2.0,0)'::point
/ Scaling/rotation '((0,0),(2,2))'::box / '(2.0,0)'::point
# Intersection '((1,-1),(-1,1))' # '((1,1),(-1,-1))'
# Number of points in polygon # '((1,0),(0,1),(-1,0))'
## Point of closest proximity '(0,0)'::point ## '((2,0),(0,2))'::lseg
&& Overlaps? '((0,0),(1,1))'::box && '((0,0),(2,2))'::box
&< Overlaps to left? '((0,0),(1,1))'::box &< '((0,0),(2,2))'::box
&> Overlaps to right? '((0,0),(3,3))'::box &> '((0,0),(2,2))'::box
<-> Distance between '((0,0),1)'::circle <-> '((5,0),1)'::circle
<< Left of? '((0,0),1)'::circle << '((5,0),1)'::circle
<^ Is below? '((0,0),1)'::circle <^ '((0,5),1)'::circle
>> Is right of? '((5,0),1)'::circle >> '((0,0),1)'::circle
>^ Is above? '((0,5),1)'::circle >^ '((0,0),1)'::circle
?# Intersects or overlaps '((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box;
?- Is horizontal? '(1,0)'::point ?- '(0,0)'::point
?-| Is perpendicular? '((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg
@-@ Length or circumference @-@ '((0,0),(1,0))'::path
?| Is vertical? '(0,1)'::point ?| '(0,0)'::point
?|| Is parallel? '((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg
@ Contained or on '(1,1)'::point @ '((0,0),2)'::circle
@@ Center of @@ '((0,0),10)'::circle
~= Same as '((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon