PostgreSQL point(polygon) Function
The PostgreSQL point(polygon)
function calculates the center point of the specified polygon and returns that. It is the average of the polygon’s multiple point positions.
point(polygon)
Syntax
This is the syntax of the PostgreSQL point(polygon)
function:
point(polygon) -> point
Parameters
polygon
-
Required. A polygon. For example:
polygon '((0,0),(1,1),(2,0))'
.
Return value
The PostgreSQL point(polygon)
function returns the center point of the polygon specified by the parameter.
point(polygon)
Examples
The following statement shows how to use the PostgreSQL point(polygon)
function to return the center point of polygon '((0,0),(1,1),(2,0))'
.
SELECT point(polygon '((0,0),(1,1),(2,0))');
point
------------------------
(1,0.3333333333333333)
The following statement shows how to use the PostgreSQL point(polygon)
function to return the center point of polygon '(-1,1),(1,1),(1,-1),(-1,-1)'
.
SELECT point(polygon '(-1,1),(1,1),(1,-1),(-1,-1)');
point
-------
(0,0)