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

> 计算地球两点之间的球面距离，单位为米。

计算地球两点之间的球面距离，单位是「米」。

## 语法

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

## 参数说明

`x_lng`: X 点的经度，支持的数据类型为 DOUBLE。

`x_lat`: X 点的纬度，支持的数据类型为 DOUBLE。

`y_lng`: Y 点的经度，支持的数据类型为 DOUBLE。

`y_lat`: Y 点的纬度，支持的数据类型为 DOUBLE。

## 返回值说明

返回值的数据类型为 DOUBLE。

## 示例

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

## 相关数据类型

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


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