ST_AZIMUTH

functionsupportedCore SQL functions

docs.snowflake.com ↗

Geospatial functions

Given a Point that represents the origin (the location of the observer) and a specified Point, returns the azimuth in radians. Both Points must be either GEOGRAPHY or GEOMETRY objects. The azimuth is the angle between the two Points when the observer at the origin is facing the north (for GEOGRAPHY objects) or the Y-axis (for GEOMETRY objects). The angle is positive in the clockwise direction and is: - 0 for a line segment pointing north. - π/2 for a line segment pointing east. - π for a line segment pointing south. - 3π/2 for a line segment pointing west. If the two Points are the same location, the function returns NULL. For GEOGRAPHY objects, on spherical Earth, the formula described here is used to determine the azimuth. Caution Systems using an elliptical Earth model use a more complex algorithm for Azimuth, which occasionally yields significantly different results.

Syntax

ST_AZIMUTH( <geography_expression_for_origin> , <geography_expression_for_target> )
ST_AZIMUTH( <geometry_expression_for_origin> , <geometry_expression_for_target> )

Parameters

NameRequiredDescription
geography_expression_for_originrequiredA GEOGRAPHY object that is a Point representing the origin (where the observer is located).
geography_expression_for_targetrequiredA GEOGRAPHY object that is a Point for which you want to calculate the azimuth.
geometry_expression_for_originrequiredA GEOMETRY object that is a Point representing the origin (where the observer is located).
geometry_expression_for_targetrequiredA GEOMETRY object that is a Point for which you want to calculate the azimuth.

Returns

Returns a value of type REAL that is the azimuth in radians.

Usage notes