Geometric Operators
+
Description: The operator implements a panning function by adding the coordinates of the second point to each corresponding point of the first parameter.
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(1,1))' + point '(2.0,0)' AS RESULT; result ------------- (3,1),(2,0) (1 row) |
-
Description: The operator implements a panning function by subtracting the coordinates of the second point from each corresponding point of the first parameter.
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(1,1))' - point '(2.0,0)' AS RESULT; result --------------- (-1,1),(-2,0) (1 row) |
*
Description: Scaling out/rotation
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(1,1))' * point '(2.0,0)' AS RESULT; result ------------- (2,2),(0,0) (1 row) |
/
Description: Scaling in/rotation
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(2,2))' / point '(2.0,0)' AS RESULT; result ------------- (1,1),(0,0) (1 row) |
#
- Description: Number of paths or polygon vertices.
1 2 3 4 5
postgres=#SELECT # path'((1,0),(0,1),(-1,0))' AS RESULT; result -------- 3 (1 row)
@-@
Description: Length or circumference
Example:
1 2 3 4 5 |
postgres=#SELECT @-@ path '((0,0),(1,0))' AS RESULT; result -------- 2 (1 row) |
@@
Description: Center of box
Example:
1 2 3 4 5 |
postgres=#SELECT @@ circle '((0,0),10)' AS RESULT; result -------- (0,0) (1 row) |
##
Description: Closest point to first figure on second figure.
Example:
1 2 3 4 5 |
postgres=#SELECT point '(0,0)' ## box '((2,0),(0,2))' AS RESULT; result -------- (0,0) (1 row) |
<->
Description: Distance between the two figures.
Example:
1 2 3 4 5 |
postgres=#SELECT circle '((0,0),1)' <-> circle '((5,0),1)' AS RESULT; result -------- 3 (1 row) |
&&
Description: Overlaps? (One point in common makes this true.)
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(1,1))' && box '((0,0),(2,2))' AS RESULT; result -------- t (1 row) |
<<
Description: Is strictly left of (no common horizontal coordinate)?
Example:
1 2 3 4 5 |
postgres=#SELECT circle '((0,0),1)' << circle '((5,0),1)' AS RESULT; result -------- t (1 row) |
>>
Description: Is strictly right of (no common horizontal coordinate)?
Example:
1 2 3 4 5 |
postgres=#SELECT circle '((5,0),1)' >> circle '((0,0),1)' AS RESULT; result -------- t (1 row) |
&<
Description: Whether the right edge of a graphic is no further right than the right edge of another graphic.
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(1,1))' &< box '((0,0),(2,2))' AS RESULT; result -------- t (1 row) |
&>
Description: Whether the left edge of a graphic is no further left than the left edge of another graphic.
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(3,3))' &> box '((0,0),(2,2))' AS RESULT; result -------- t (1 row) |
<<|
Description: Is strictly below (no common horizontal coordinate)?
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(3,3))' <<| box '((3,4),(5,5))' AS RESULT; result -------- t (1 row) |
|>>
Description: Is strictly above (no common horizontal coordinate)?
Example:
1 2 3 4 5 |
postgres=#SELECT box '((3,4),(5,5))' |>> box '((0,0),(3,3))' AS RESULT; result -------- t (1 row) |
&<|
Description: Whether the top edge of a graphic is no higher than the top edge of another graphic.
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(1,1))' &<| box '((0,0),(2,2))' AS RESULT; result -------- t (1 row) |
|&>
Description: Whether the bottom edge of a graphic is no lower than the bottom edge of another graphic.
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(3,3))' |&> box '((0,0),(2,2))' AS RESULT; result -------- t (1 row) |
<^
Description: Is below (allows touching)?
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(-3,-3))' <^ box '((0,0),(2,2))' AS RESULT; result -------- t (1 row) |
>^
Description: Is above (allows touching)?
Example:
1 2 3 4 5 |
postgres=#SELECT box '((0,0),(2,2))' >^ box '((0,0),(-3,-3))' AS RESULT; result -------- t (1 row) |
?#
Description: Intersect?
Example:
1 2 3 4 5 |
postgres=#SELECT lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))' AS RESULT; result -------- t (1 row) |
?-
- Description: Whether it is horizontally aligned.
1 2 3 4 5
postgres=#SELECT point '(1,0)' ?- point '(0,0)' AS RESULT; result -------- t (1 row)
?|
- Description: Whether it is vertically aligned.
1 2 3 4 5
postgres=#SELECT point '(0,1)' ?| point '(0,0)' AS RESULT; result -------- t (1 row)
?
Description: Are perpendicular?
Example:
1 2 3 4 5 |
postgres=#SELECT lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))' AS RESULT; result -------- t (1 row) |
?||
Description: Are parallel?
Example:
1 2 3 4 5 |
postgres=#SELECT lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))' AS RESULT; result -------- t (1 row) |
@>
Description: Contains?
Example:
1 2 3 4 5 |
postgres=#SELECT circle '((0,0),2)' @> point '(1,1)' AS RESULT; result -------- t (1 row) |
<@
Description: Contained in or on?
Example:
1 2 3 4 5 |
postgres=#SELECT point '(1,1)' <@ circle '((0,0),2)' AS RESULT; result -------- t (1 row) |
~=
Description: Same as?
Example:
1 2 3 4 5 |
postgres=#SELECT polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))' AS RESULT; result -------- t (1 row) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot