ST_Azimuth
Signature
DOUBLE ST_Azimuth(GEOMETRY pointA, GEOMETRY pointB);
Description
Returns the azimuth in radians of the segment from pointA
to
pointB
clockwise from the North (0, 1).
Returns NULL
if pointA
and pointB
are not POINT
Geometries
or are coincident.
Examples
SELECT ST_Azimuth('LINESTRING(0 0, 5 5)', 'POINT(10 0)');
-- Answer: NULL
SELECT DEGREES(ST_Azimuth('POINT(0 1)', 'POINT(10 1)'));
-- Answer: 90.0
SELECT ST_Azimuth('POINT(0 1)', 'POINT(10 1)');
-- Answer: 1.5707963267948966