A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/st_azimuth below:

Website Navigation


ST_AZIMUTH | Snowflake Documentation

ST_AZIMUTH

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:

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.

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

Copy

Arguments
geography_expression_for_origin

A GEOGRAPHY object that is a Point representing the origin (where the observer is located).

geography_expression_for_target

A GEOGRAPHY object that is a Point for which you want to calculate the azimuth.

geometry_expression_for_origin

A GEOMETRY object that is a Point representing the origin (where the observer is located).

geometry_expression_for_target

A 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 Examples GEOGRAPHY examples

The following example returns the azimuth in radians for an origin Point (0, 1) and a target Point (0, 0):

SELECT ST_AZIMUTH(
    TO_GEOGRAPHY('POINT(0 1)'),
    TO_GEOGRAPHY('POINT(0 0)')
);
+---------------------------------+
|                     ST_AZIMUTH( |
|     TO_GEOGRAPHY('POINT(0 1)'), |
|      TO_GEOGRAPHY('POINT(0 0)') |
|                               ) |
|---------------------------------|
|                     3.141592654 |
+---------------------------------+

Copy

The following example returns the azimuth in degrees for an origin Point (0, 1) and a target Point (1, 2):

SELECT DEGREES(ST_AZIMUTH(
    TO_GEOGRAPHY('POINT(0 1)'),
    TO_GEOGRAPHY('POINT(1 2)')
));
+---------------------------------+
|             DEGREES(ST_AZIMUTH( |
|     TO_GEOGRAPHY('POINT(0 1)'), |
|      TO_GEOGRAPHY('POINT(1 2)') |
|                              )) |
|---------------------------------|
|                    44.978182941 |
+---------------------------------+

Copy

GEOMETRY examples

The following example returns the azimuth in radians for an origin Point (0, 1) and a target Point (0, 0):

SELECT ST_AZIMUTH(
    TO_GEOMETRY('POINT(0 1)', TO_GEOMETRY('POINT(0 0)')
);

+------------------------------------------------------------------+
| ST_AZIMUTH(TO_GEOMETRY('POINT(0 1)'), TO_GEOMETRY('POINT(0 0)')) |
|------------------------------------------------------------------|
| 3.141592654                                                      |
+------------------------------------------------------------------+

Copy

The following example returns the azimuth in degrees for an origin Point (0, 1) and a target Point (0.707, 0.707):

SELECT ST_AZIMUTH(
    TO_GEOMETRY('POINT(0 0)', TO_GEOMETRY(0.707 0.707')
);

+-------------------------------------------------------------------------+
| ST_AZIMUTH(TO_GEOMETRY('POINT(0 0)'), TO_GEOMETRY('POINT(0.707 0.707')) |
|-------------------------------------------------------------------------|
| 0.7853981634                                                            |
+-------------------------------------------------------------------------+

Copy


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4