ST_Angle
Syntax
DOUBLE ST_Angle(GEOPOINT point1, GEOPOINT point2, GEOPOINT point3)
description
输入三个点,它们表示两条相交的线。返回这些线之间的夹角。点 2 和点 1 表示第一条线,点 2 和点 3 表示第二条线。这些线之间的夹角以弧度表示,范围为 [0, 2pi)。夹角按顺时针方向从第一条线开始测量,直至第二条线。
ST_ANGLE 存在以下边缘情况:
- 如果点 2 和点 3 相同,则返回 NULL。
- 如果点 2 和点 1 相同,则返回 NULL。
- 如果点 2 和点 3 是完全对映点,则返回 NULL。
- 如果点 2 和点 1 是完全对映点,则返回 NULL。
- 如果任何输入地理位置不是单点或为空地理位置,则会抛出错误。
example
1. mysql> SELECT ST_Angle(ST_Point(1, 0),ST_Point(0, 0),ST_Point(0, 1));
2. +----------------------------------------------------------------------+
3. | st_angle(st_point(1.0, 0.0), st_point(0.0, 0.0), st_point(0.0, 1.0)) |
4. +----------------------------------------------------------------------+
5. | 4.71238898038469 |
6. +----------------------------------------------------------------------+
7. 1 row in set (0.04 sec)
9. mysql> SELECT ST_Angle(ST_Point(0, 0),ST_Point(1, 0),ST_Point(0, 1));
10. +----------------------------------------------------------------------+
11. | st_angle(st_point(0.0, 0.0), st_point(1.0, 0.0), st_point(0.0, 1.0)) |
12. +----------------------------------------------------------------------+
13. | 0.78547432161873854 |
14. +----------------------------------------------------------------------+
15. 1 row in set (0.02 sec)
17. mysql> SELECT ST_Angle(ST_Point(1, 0),ST_Point(0, 0),ST_Point(1, 0));
18. +----------------------------------------------------------------------+
19. | st_angle(st_point(1.0, 0.0), st_point(0.0, 0.0), st_point(1.0, 0.0)) |
20. +----------------------------------------------------------------------+
21. | 0 |
22. +----------------------------------------------------------------------+
23. 1 row in set (0.02 sec)
25. mysql> SELECT ST_Angle(ST_Point(1, 0),ST_Point(0, 0),ST_Point(0, 0));
26. +----------------------------------------------------------------------+
27. | st_angle(st_point(1.0, 0.0), st_point(0.0, 0.0), st_point(0.0, 0.0)) |
28. +----------------------------------------------------------------------+
29. | NULL |
30. +----------------------------------------------------------------------+
31. 1 row in set (0.03 sec)
33. mysql> SELECT ST_Angle(ST_Point(0, 0),ST_Point(-30, 0),ST_Point(150, 0));
34. +--------------------------------------------------------------------------+
35. | st_angle(st_point(0.0, 0.0), st_point(-30.0, 0.0), st_point(150.0, 0.0)) |
36. +--------------------------------------------------------------------------+
37. | NULL |
38. +--------------------------------------------------------------------------+
39. 1 row in set (0.02 sec)
keywords
ST_ANGLE,ST,ANGLE
