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

# ST_Distance_Sphere

> Calculates the spherical distance between two points on the Earth in 'meters'.

Calculates the spherical distance between two points on the Earth in "meters". The parameters inputted are longitude at X, latitude at X, longitude at Y, latitude at Y.

## Syntax

```sql theme={null}
DOUBLE ST_Distance_Sphere(DOUBLE x_lng, DOUBLE x_lat, DOUBLE y_lng, DOUBLE y_lat)
```

## Examples

```Plain Text theme={null}
MySQL > select st_distance_sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219);
+----------------------------------------------------------------------------+
| st_distance_sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219) |
+----------------------------------------------------------------------------+
|                                                         7336.9135549995917 |
+----------------------------------------------------------------------------+
```

## keyword

ST\_DISTANCE\_SPHERE,ST,DISTANCE,SPHERE

## Related data types

[DOUBLE](/documents/4.2/sql-reference/data-types/numeric/DOUBLE.md)


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