Enter three points that represent two intersecting lines. Return the Angle between these lines.
ST_ANGLE( <point1>, <point2>, <point3>)
| Parameters | Instructions |
|---|---|
<point1> | The first point of the first line |
<point2> | The second point of the first line and the first point of the second line |
<point3> | The second point of the second line |
The Angle between these lines is expressed in radians and ranges from [0, 2pi]. The Angle is measured clockwise from the first line to the second line.
ST_ANGLE has the following edge cases:
SELECT ST_Angle(ST_Point(1, 0),ST_Point(0, 0),ST_Point(0, 1));
+----------------------------------------------------------------------+ | st_angle(st_point(1.0, 0.0), st_point(0.0, 0.0), st_point(0.0, 1.0)) | +----------------------------------------------------------------------+ | 4.71238898038469 | +----------------------------------------------------------------------+
SELECT ST_Angle(ST_Point(0, 0),ST_Point(1, 0),ST_Point(0, 1));
+----------------------------------------------------------------------+ | st_angle(st_point(0.0, 0.0), st_point(1.0, 0.0), st_point(0.0, 1.0)) | +----------------------------------------------------------------------+ | 0.78547432161873854 | +----------------------------------------------------------------------+
SELECT ST_Angle(ST_Point(1, 0),ST_Point(0, 0),ST_Point(1, 0));
+----------------------------------------------------------------------+ | st_angle(st_point(1.0, 0.0), st_point(0.0, 0.0), st_point(1.0, 0.0)) | +----------------------------------------------------------------------+ | 0 | +----------------------------------------------------------------------+
SELECT ST_Angle(ST_Point(1, 0),ST_Point(0, 0),ST_Point(0, 0));
+----------------------------------------------------------------------+ | st_angle(st_point(1.0, 0.0), st_point(0.0, 0.0), st_point(0.0, 0.0)) | +----------------------------------------------------------------------+ | NULL | +----------------------------------------------------------------------+
SELECT ST_Angle(ST_Point(0, 0),ST_Point(-30, 0),ST_Point(150, 0));
+--------------------------------------------------------------------------+ | st_angle(st_point(0.0, 0.0), st_point(-30.0, 0.0), st_point(150.0, 0.0)) | +--------------------------------------------------------------------------+ | NULL | +--------------------------------------------------------------------------+