Skip to content

ST_Centroid

Returns the centroid of a geometry.

Usage

geometry ST_Centroid(geom: geometry)

Arguments

  • geom (geometry): Input geometry

Examples

SELECT ST_Centroid(
  ST_GeomFromWKT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_centroid(st_geomfromwkt(Utf8("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"))) │
│                                   geometry                                   │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(5 5)                                                                   │
└──────────────────────────────────────────────────────────────────────────────┘