ST_ANGLE_SPHERE
Descriptionβ
Calculate the center Angle between two points on the Earth's surface in degrees. The parameters passed in are the longitude of point X, latitude of point X, longitude of point Y, and latitude of point Y.
Syntaxβ
ST_Angle_Sphere( <x_lng>, <x_lat>, <y_lng>, <y_lat>)
Parametersβ
Parameters | Instructions |
---|---|
<x_lng> | Longitude data, reasonable value range is [-180, 180] |
<y_lng> | Longitude data, reasonable value range is [-180, 180] |
<x_lat> | Latitude data, reasonable value range is [-90, 90] |
<y_lat> | Latitude data, reasonable value range is [-90, 90] |
Return Valueβ
The Angle of the center between two points
Examplesβ
select ST_Angle_Sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219);
+---------------------------------------------------------------------------+
| st_angle_sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219) |
+---------------------------------------------------------------------------+
| 0.0659823452409903 |
+---------------------------------------------------------------------------+
select ST_Angle_Sphere(0, 0, 45, 0);
+----------------------------------------+
| st_angle_sphere(0.0, 0.0, 45.0, 0.0) |
+----------------------------------------+
| 45 |
+----------------------------------------+