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 Engine API reference for azimuth.

Examples

PythonPythonSQLScala
1
2
3
4
5
6
7
8
9
10
11
12
13

from geoanalytics.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
1
2
3
4
5
6
7
+------------+
|     azimuth|
+------------+
|44.148521949|
|         0.0|
|90.292398857|
+------------+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close