> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_GeometricMedian

Computes the approximate geometric median of a MultiPoint geometry using the Weiszfeld algorithm. The geometric median provides a centrality measure that is less sensitive to outlier points than the centroid.

<img src="https://mintcdn.com/wherobots/fqh3gPDE0J25Lra_/images/sql-functions/ST_GeometricMedian/ST_GeometricMedian.svg?fit=max&auto=format&n=fqh3gPDE0J25Lra_&q=85&s=fbce3d144476fcb3eb49d253409d9290" alt="ST_GeometricMedian" width="500" height="300" data-path="images/sql-functions/ST_GeometricMedian/ST_GeometricMedian.svg" />

The algorithm will iterate until the distance change between successive iterations is less than the supplied `tolerance` parameter. If this condition has not been met after `maxIter` iterations, the function will produce an error and exit, unless `failIfNotConverged` is set to `false`.

If a `tolerance` value is not provided, a default `tolerance` value is `1e-6`.

## Signatures

```sql theme={"system"}
ST_GeometricMedian(geom: Geometry, tolerance: Double, maxIter: Integer, failIfNotConverged: Boolean)
```

```sql theme={"system"}
ST_GeometricMedian(geom: Geometry, tolerance: Double, maxIter: Integer)
```

```sql theme={"system"}
ST_GeometricMedian(geom: Geometry, tolerance: Double)
```

```sql theme={"system"}
ST_GeometricMedian(geom: Geometry)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="tolerance" type="Double">
  The distance tolerance.
</ParamField>

<ParamField body="maxIter" type="Integer">
  The max iter value.
</ParamField>

<ParamField body="failIfNotConverged" type="Boolean">
  The fail if not converged value.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_GeometricMedian(ST_GeomFromWKT('MULTIPOINT((0 0), (1 1), (2 2), (200 200))'))
```

```
POINT (1.9761550281255005 1.9761550281255005)
```
