ST_AZIMUTH()
All functions > GEOSPATIAL > ST_AZIMUTH()
Returns the azimuth angle in radians from point A to point B, measured clockwise from north (positive Y axis).
Signatures
Azimuth
Returns: Azimuth in radians in the range [0, 2π)
ST_AZIMUTH(geo1: T, geo2: T) → DOUBLE sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo1 | T | Yes | Origin point |
geo2 | T | Yes | Target point |
With:
T: Custom types: GEOM_POINT | GEOG_POINT
Signature notes:
- Returns angle in radians (not degrees), measured clockwise from the positive Y axis (north)
- Range is [0, 2π); due north = 0, due east = π/2 (~1.5708), due south = π, due west = 3π/2—users expecting compass degrees (e.g. 90° east) should multiply by
180.0 / PI() - Returns NULL if either point is NULL or if both points are equal
- On GEOMETRY: planar azimuth in SRID coordinate units
- On GEOGRAPHY: initial bearing of the great circle arc from geo1 to geo2
- GEOGRAPHY overload: supported on DuckDB and BigQuery only; not supported on Trino or DataFusion
Examples
Geometry (planar)
FeatureQL
SELECT
f1 := ST_AZIMUTH(ST_GEOMPOINT(0.0, 0.0), ST_GEOMPOINT(0.0, 1.0)), -- Due north: azimuth is 0
f2 := ST_AZIMUTH(ST_GEOMPOINT(0.0, 0.0), ST_GEOMPOINT(1.0, 0.0)) -- Due east: π/2 radians (not 90° unless converted)
;Result
| f1 VARCHAR | f2 VARCHAR |
|---|---|
| 0.0 | 1.5707963 |
Geography (geodesic)
FeatureQL
SELECT
f1 := ST_AZIMUTH(ST_GEOGPOINT(2.3522, 48.8566), ST_GEOGPOINT(2.3522, 51.5074)) -- Paris to London (same longitude): due north
;Result
| f1 VARCHAR |
|---|
| 0.0 |