ST_Azimuth

ST_Azimuth takes two geometry columns and returns a double column representing the normalized azimuth in degrees. The output azimuth angle is heading from the first geometry to the second geometry. The angle is referenced from the north and is positive clockwise. This function requires that the first geometry column have a spatial reference set.

If the two geometry columns are in different spatial references, the function will automatically transform the second geometry into the spatial reference of the first.

FunctionSyntax
Pythonazimuth(geometry1, geometry2)
SQLST_Azimuth(geometry1, geometry2)
Scalaazimuth(geometry1, geometry2)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for azimuth.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from geoanalytics_fabric.sql import functions as ST, Point
from pyspark.sql import functions as F

data = [
    (Point(-176, -15),),
    (Point(-178, -15),),
    (Point(-176, -17),)
]

df = spark.createDataFrame(data, ["point"])

df.select(F.round(ST.azimuth(ST.point(-178.0, -17.0, 4326), ST.srid("point", 4326)), 9).alias("azimuth")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
+------------+
|     azimuth|
+------------+
|44.148521949|
|         0.0|
|90.292398857|
+------------+

Version table

ReleaseNotes

1.0.0-beta

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.