> ## 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 (Python)

> Computes the approximate geometric median of a MultiPoint geometry using the Weiszfeld algorithm.

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.
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`.

SQL reference: [`ST_GeometricMedian`](/reference/wherobots-db/geometry-data/processing/ST_GeometricMedian)

## Signature

```python theme={"system"}
from sedona.spark.sql.st_functions import ST_GeometricMedian

ST_GeometricMedian(
    geometry: ColumnOrName,
    tolerance: Optional[Union[ColumnOrName, float]] = 1e-06,
    max_iter: Optional[Union[ColumnOrName, int]] = 1000,
    fail_if_not_converged: Optional[Union[ColumnOrName, bool]] = False,
) -> Column
```

## Parameters

<ParamField path="geometry" type="ColumnOrName" required>
  MultiPoint or Point geometry.
</ParamField>

<ParamField path="tolerance" type="Optional[Union[ColumnOrName, float]]" default="1e-06">
  Distance limit change between successive iterations, defaults to 1e-6.
</ParamField>

<ParamField path="max_iter" type="Optional[Union[ColumnOrName, int]]" default="1000">
  Max number of iterations, defaults to 1000.
</ParamField>

<ParamField path="fail_if_not_converged" type="Optional[Union[ColumnOrName, bool]]" default="False">
  Generate error if not converged within given tolerance and number of iterations, defaults to False
</ParamField>

## Returns

<ResponseField name="return" type="Column">
  Point geometry column.
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.