PostgreSQL circle(polygon) Function

The PostgreSQL circle(polygon) function converts the specified polygon to a circle. The center of the circle is the average of the polygon point positions, and the radius is the average distance from the polygon point to that center.

circle(polygon) Syntax

This is the syntax of the PostgreSQL circle(polygon) function:

circle(polygon) -> circle

Parameters

polygon

Required. A polygon. For example: polygon '((0,0),(1,3),(2,0))'.

Return value

The PostgreSQL circle(polygon) function returns a circle converted from the specified polygon.

circle(polygon) Examples

The following statement shows how to use the PostgreSQL circle(polygon) function to get a circle from the polygon polygon '((0,0),(1,3),(2,0))'.

SELECT circle(polygon '((0,0),(1,3),(2,0))');
           circle
----------------------------
 <(1,1),1.6094757082487299>