ST_MultiCentroid — Returns a centroid for each part of a complex geometry.
geometry MultiCentroid(
bytea
Geometry)
;
Returns a centroid for each part of a complex geometry. Thus, a MultiPolygon composed of two Polygons woud have as MultiCentroid a MultiPoint with two Points.
GeometryCollections are supported |
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
- | - | - | - |
SELECT ST_AsText(ST_MultiCentroid(ST_GeomFromText(' GEOMETRYCOLLECTION (LINESTRING (0 0, 10 10, 10 5, 15 10), MULTIPOLYGON (((-5 20, -5 34, 11 34, 11 20, -5 20)), ( (14 20, 14 29, 23 29, 23 20, 14 20))))') )); --Result MULTIPOINT ((7.976858924576366 6.15123928305091), (3 27), (18.5 24.5))
GeomA | ST_MultiCentroid (GeomA) |