ST_Azimuth - Amazon Redshift

ST_Azimuth

ST_Azimuth returns the north-based Cartesian azimuth using the 2D projections of the two input points.

Syntax

ST_Azimuth(point1, point2)

Arguments

point1

A POINT value of data type GEOMETRY. The spatial reference system identifier (SRID) of point1 must match the SRID of point2.

point2

A POINT value of data type GEOMETRY. The SRID of point2 must match the SRID of point1.

Return type

A number that is an angle in radians of DOUBLE PRECISION data type. Values range from 0 (inclusive) to 2 pi (exclusive).

If point1 or point2 is the empty point, then an error is returned.

If either point1 or point2 is null, then null is returned.

If point1 and point2 are equal, then null is returned.

If point1 or point2 is not a point, then an error is returned.

If point1 and point2 don't have the value for the spatial reference system identifier (SRID), then an error is returned.

Examples

The following SQL returns the azimuth of the input points.

SELECT ST_Azimuth(ST_Point(1,2), ST_Point(5,6));
st_azimuth ------------------- 0.7853981633974483