You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/sql/geography/Geography-Functions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,7 @@ These functions operate on geography type objects.
44
44
|[ST_Area](Geography-Functions/ST_Area.md)| Double | Return the geodesic area of a geography in square meters (WGS84 spheroid). | v1.9.1 |
45
45
|[ST_AsEWKT](Geography-Functions/ST_AsEWKT.md)| String | Return the Extended Well-Known Text representation of a geography. | v1.8.0 |
46
46
|[ST_AsText](Geography-Functions/ST_AsText.md)| String | Return the Well-Known Text (WKT) representation of a geography. | v1.9.1 |
47
+
|[ST_Centroid](Geography-Functions/ST_Centroid.md)| Geography | Return the planar centroid of a geography as a Geography point (computed in projected lon/lat space). | v1.9.1 |
47
48
|[ST_Buffer](Geography-Functions/ST_Buffer.md)| Geography | Return the metric ε-buffer of a geography. Distance is always interpreted as meters along the spheroid. | v1.9.1 |
48
49
|[ST_Envelope](Geography-Functions/ST_Envelope.md)| Geography | Return the bounding box (envelope) of a geography. Supports anti-meridian splitting. | v1.8.0 |
49
50
|[ST_GeometryType](Geography-Functions/ST_GeometryType.md)| String | Return the type of a geography as a string (e.g., "ST_Point", "ST_Polygon"). | v1.9.1 |
Licensed to the Apache Software Foundation (ASF) under one
3
+
or more contributor license agreements. See the NOTICE file
4
+
distributed with this work for additional information
5
+
regarding copyright ownership. The ASF licenses this file
6
+
to you under the Apache License, Version 2.0 (the
7
+
"License"); you may not use this file except in compliance
8
+
with the License. You may obtain a copy of the License at
9
+
10
+
http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+
Unless required by applicable law or agreed to in writing,
13
+
software distributed under the License is distributed on an
14
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+
KIND, either express or implied. See the License for the
16
+
specific language governing permissions and limitations
17
+
under the License.
18
+
-->
19
+
20
+
# ST_Centroid
21
+
22
+
Introduction: Returns the spherical centroid of a geography as a Geography point, computed on the sphere using S2:
23
+
24
+
-**Polygon / MultiPolygon** — area-weighted centroid via `S2Polygon.getCentroid()`.
25
+
-**LineString / MultiLineString** — length-weighted centroid via `S2Polyline.getCentroid()`.
26
+
-**Point / MultiPoint** — mean of the unit vectors.
27
+
-**GeographyCollection** — recursive weighted sum across the children.
28
+
29
+
The result is the unit-length centroid on the sphere. Unlike a planar (lon/lat) centroid, it is correct for antimeridian-crossing and high-latitude geographies. As with JTS for non-convex shapes, the centroid may lie outside the input geometry. Returns `NULL` when the centroid is undefined (empty geometry, or antipodal points whose unit vectors cancel).
Output (small `O(d²/R²)` spherical correction vs the planar `(1 1)`):
46
+
47
+
```
48
+
POINT (1 1)
49
+
```
50
+
51
+
For an antimeridian-crossing polygon, the spherical centroid stays on the antimeridian instead of jumping to the opposite side of the planet, which a planar centroid would do:
0 commit comments