snowflake.snowpark.functions.st_azimuth

snowflake.snowpark.functions.st_azimuth(geography_or_geometry_origin: Union[snowflake.snowpark.column.Column, str], geography_or_geometry_target: Union[snowflake.snowpark.column.Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.40.0/src/snowflake/snowpark/_functions/scalar_functions.py#L2227-L2261)

Calculates the azimuth (bearing) in radians from the origin point to the target point. The azimuth is measured clockwise from north and returned as a value between 0 and 2π.

Parameters:
  • geography_or_geometry_origin (ColumnOrName) – The origin point as a GEOGRAPHY or GEOMETRY object

  • geography_or_geometry_target (ColumnOrName) – The target point as a GEOGRAPHY or GEOMETRY object

Returns:

The azimuth in radians from origin to target point

Return type:

Column

Examples:

>>> from snowflake.snowpark.functions import to_geography
>>> df = session.create_dataframe([
...     ["POINT(0 1)", "POINT(0 0)"],
...     ["POINT(0 1)", "POINT(1 2)"]
... ], schema=["origin", "target"])
>>> df.select(
...     st_azimuth(
...         to_geography(df["origin"]),
...         to_geography(df["target"])
...     ).alias("azimuth")
... ).collect()
[Row(AZIMUTH=3.141592653589793), Row(AZIMUTH=0.785017383892913)]
Copy
Language: English