DOUBLE ST_Azimuth(GEOPOINT point1, GEOPOINT point2)
Enter two point, and returns the azimuth of the line segment formed by points 1 and 2. The azimuth is the angle in radians measured between the line from point 1 facing true North to the line segment from point 1 to point 2.
The positive angle is measured clockwise on the surface of a sphere. For example, the azimuth for a line segment:
ST_Azimuth has the following edge cases:
mysql> SELECT st_azimuth(ST_Point(1, 0),ST_Point(0, 0)); +----------------------------------------------------+ | st_azimuth(st_point(1.0, 0.0), st_point(0.0, 0.0)) | +----------------------------------------------------+ | 4.71238898038469 | +----------------------------------------------------+ 1 row in set (0.03 sec) mysql> SELECT st_azimuth(ST_Point(0, 0),ST_Point(1, 0)); +----------------------------------------------------+ | st_azimuth(st_point(0.0, 0.0), st_point(1.0, 0.0)) | +----------------------------------------------------+ | 1.5707963267948966 | +----------------------------------------------------+ 1 row in set (0.01 sec) mysql> SELECT st_azimuth(ST_Point(0, 0),ST_Point(0, 1)); +----------------------------------------------------+ | st_azimuth(st_point(0.0, 0.0), st_point(0.0, 1.0)) | +----------------------------------------------------+ | 0 | +----------------------------------------------------+ 1 row in set (0.01 sec) mysql> SELECT st_azimuth(ST_Point(0, 1),ST_Point(0, 1)); +----------------------------------------------------+ | st_azimuth(st_point(0.0, 1.0), st_point(0.0, 1.0)) | +----------------------------------------------------+ | NULL | +----------------------------------------------------+ 1 row in set (0.02 sec) mysql> SELECT st_azimuth(ST_Point(-30, 0),ST_Point(150, 0)); +--------------------------------------------------------+ | st_azimuth(st_point(-30.0, 0.0), st_point(150.0, 0.0)) | +--------------------------------------------------------+ | NULL | +--------------------------------------------------------+ 1 row in set (0.02 sec)
ST_AZIMUTH,ST,AZIMUTH