ST_CENTROID
functionsupportedCore SQL functionsReturns the Point representing the geometric center of a GEOGRAPHY or GEOMETRY object.
Syntax
ST_CENTROID( <geography_or_geometry_expression> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_or_geometry_expression | required | The argument must be an expression of type GEOGRAPHY or GEOMETRY. |
Returns
Returns a GEOGRAPHY or GEOMETRY object for the Point that represents geometric center of the input object.
Usage notes
- Returns NULL if the input is NULL.
- If the input object is a GeometryCollection that contains different types of objects (Polygons, LineStrings, and Points), ST_CENTROID uses the type with the highest dimension to determine the geometric center. For example: If the GeometryCollection contains Polygons, LineStrings, and Points, ST_CENTROID uses the Polygons and ignores the LineStrings and Points in the collection.
- If the GeometryCollection contains LineStrings and Points, ST_CENTROID uses the LineStrings and ignores the Points in the collection.
- For GEOMETRY objects, the returned GEOMETRY object has the same SRID as the input.