> ## 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_DistanceSphere

Return the haversine / great-circle distance of A using a given earth radius (default radius: 6371008.0). Unit is meter. Compared to `ST_Distance` + `ST_Transform`, it works better for datasets that cover large regions such as continents or the entire planet. It is equivalent to PostGIS `ST_Distance(geography, use_spheroid=false)` and `ST_DistanceSphere` function and produces nearly identical results. It provides faster but less accurate result compared to `ST_DistanceSpheroid`.

Geometry must be in EPSG:4326 (WGS84) projection and must be in ==lon/lat== order. You can use ==ST\_FlipCoordinates== to swap lat and lon. For non-point data, we first take the centroids of both geometries and then compute the distance.

<Note>
  By default, this function uses lon/lat order since `v1.5.0`. Before, it used lat/lon order.
</Note>

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

## Signatures

```sql theme={"system"}
ST_DistanceSphere (A: Geometry)
```

## Parameters

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

## Return type

<ResponseField type="Double">
  A numeric value.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT ST_DistanceSphere(ST_GeomFromWKT('POINT (-0.56 51.3168)'), ST_GeomFromWKT('POINT (-3.1883 55.9533)'))
```

```
543796.9506134904
```

```sql theme={"system"}
SELECT ST_DistanceSphere(ST_GeomFromWKT('POINT (-0.56 51.3168)'), ST_GeomFromWKT('POINT (-3.1883 55.9533)'), 6378137.0)
```

```
544405.4459192449
```
