ST_Angle_Sphere

Syntax

DOUBLE ST_Angle_Sphere(DOUBLE x_lng, DOUBLE x_lat, DOUBLE y_lng, DOUBLE y_lat)

description

计算地球表面两点之间的圆心角,单位为 度。传入的参数分别为X点的经度,X点的纬度,Y点的经度,Y点的纬度。

x_lng 和 y_lng 都是经度数据,合理的取值范围是 [-180, 180]。

x_lat 和 y_lat 都是纬度数据,合理的取值范围是 [-90, 90]。

example

  1. mysql> select ST_Angle_Sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219);
  2. +---------------------------------------------------------------------------+
  3. | st_angle_sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219) |
  4. +---------------------------------------------------------------------------+
  5. | 0.0659823452409903 |
  6. +---------------------------------------------------------------------------+
  7. 1 row in set (0.06 sec)
  8. mysql> select ST_Angle_Sphere(0, 0, 45, 0);
  9. +----------------------------------------+
  10. | st_angle_sphere(0.0, 0.0, 45.0, 0.0) |
  11. +----------------------------------------+
  12. | 45 |
  13. +----------------------------------------+
  14. 1 row in set (0.06 sec)

keywords

ST_ANGLE_SPHERE,ST,ANGLE,SPHERE