Name

ST_Centroid — Returns the geometric center of a geometry.

Synopsis

geometry ST_Centroid(geometry
g1);

Description

Computes the geometric center of a geometry, or equivalently,
the center of mass of the geometry as a POINT. For
[MULTI]POINTs, this is computed
as the arithmetric mean of the input coordinates. For
[MULTI]LINESTRINGs, this is
computed as the weighted length of each line segment. For
[MULTI]POLYGONs, "weight" is
thought in terms of area. If an empty geometry is supplied, an empty
GEOMETRYCOLLECTION is returned. If
NULL is supplied, NULL is
returned.

The centroid is equal to the centroid of the set of component
Geometries of highest dimension (since the lower-dimension geometries
contribute zero "weight" to the centroid).

Computation will be more accurate if performed by the GEOS
module (enabled at compile time).