ST_Centroid

Determine the geometric center of a geometry.

The geometric center of the geometry is the average of the points in the geometry. For example, a centroid line with end-points (0-0) and (10,10), will produce a result of (5-5). The result is not guaranteed to be on the geometry. If the geometry is empty, an empty point is returned.

Syntax

ST_Centroid(geo);
geo
The input geometry.

Type: VARCHAR(ANY)

Returns

A value of type VARCHAR(100) that contains a point geometry.

Examples

inza..ST_AsText(inza..ST_Centroid(inza..ST_WKTToSQL('LINE STRING (0 0, 10 0)')));

ST_ASTEXT
---------
POINT (5 0)
(1 row)
inza..ST_AsText(inza..ST_Centroid(inza..ST_WKTToSQL('POLY GON ((10 10, 10 20, 20 20, 20 15, 10 10))')));

ST_ASTEXT
---------
POINT (14.4444444444444 16.1111111111111)
(1 row)