GeoDirection[{lat1,lon1},{lat2,lon2}]
gives the azimuthal direction from one latitude-longitude position on the Earth to another.
GeoDirection[loc1,loc2]
gives the azimuthal direction between locations specified by position objects or geographic entities.
GeoDirection
GeoDirection[{lat1,lon1},{lat2,lon2}]
gives the azimuthal direction from one latitude-longitude position on the Earth to another.
GeoDirection[loc1,loc2]
gives the azimuthal direction between locations specified by position objects or geographic entities.
Details
- Geo direction is also known as azimuth or bearing.
- GeoDirection[loc1,loc2] gives the clockwise angle measured at loc1 between true north and the geodesic from loc1 to loc2. Heights are ignored.
- The result is returned as a Quantity angle with "AngularDegrees" unit.
- Latitudes and longitudes can be given as numbers in degrees, as DMS strings, or as Quantity angles.
- Position objects in GeoDirection[loc1,loc2] can be given as GeoPosition, GeoPositionXYZ, GeoPositionENU, or GeoGridPosition objects.
- GeoDirection[loc1,loc2] by default uses the reference ellipsoid associated with the datum for loc1.
- GeoDirection and GeoDistance solve the geodetic inverse problem.
Examples
open all close allBasic Examples (2)
Forward azimuthal angle between two positions on the reference ellipsoid:
GeoDirection[{37, -109}, {40.112981, -88.261227}]Azimuth angle between two fully specified geodetic positions:
GeoDirection[GeoPosition[{37, -109, 150}, "ITRF00"], GeoPosition[{40.112981, -88.261227, 192.868}, "ITRF00"]]Scope (4)
Azimuth angle between any two points on the Earth, using the parameters of the default datum "ITRF00":
GeoDirection[{46.42, -21.02}, {-30.23, 40.51}]Angles can also be specified as DMS strings:
GeoDirection["46d25m12s N 21d1m12s W", {"30°13'48.''S", "40°30'36.''E"}]Direction between geodetic positions, in different formats:
p = GeoPosition[{46.42, -21.02}]q = GeoGridPosition[{0.7, 0.9}, "Mercator"]GeoDirection[p, q]GeoDirection[GeoPositionXYZ[p], GeoPositionENU[q, GeoPosition[{0, 0}]]]Height and time information is ignored in GeoDirection computations:
GeoDirection[GeoPosition[{20, 30, 100}], GeoPosition[{-20, -30, 200, 3.6 10 ^ 9}]]% === GeoDirection[GeoPosition[{20, 30}], GeoPosition[{-20, -30}]]Direction between points in different datums. The computation is performed after changing the datum of the second point to the datum of the first:
GeoDirection[GeoPosition[{30., 40.}, "ITRF90"], GeoPosition[{-50., -60.}, "WGS72"]]GeoDirection[GeoPosition[{30., 40.}], GeoPosition[{-50., -60.}]]% - %%Properties & Relations (8)
GeoDirection is not a symmetric function:
p = GeoPosition[{30, 40}];
q = GeoPosition[{50, 60}];GeoDirection[p, q]GeoDirection[q, p]GeoDirection is a partial inverse of GeoDestination:
GeoDestination[GeoPosition[{30, 40}], {10 ^ 6, 135}]GeoDirection[GeoPosition[{30, 40}], %]GeoDirection returns part of the information returned by GeoDisplacement:
p = Entity["City", {"Oslo", "Oslo", "Norway"}];
q = Entity["City", {"BuenosAires", "BuenosAires", "Argentina"}];GeoDirection[p, q]GeoDisplacement[p, q]Compute bearings between a list of points:
points = {{-20, 10}, {40, 20}, {-23, 45}, {82, -132}};GeoDirection@@@Partition[points, 2, 1]Construct points on a geodesic circle, starting with regular bearings:
points = First@GeoDestination[{70, 0}, {1000000, Range[0, 360, 6]}];Azimuths between points of the circle increase, modulo angle determination:
ListPlot[GeoDirection@@@Partition[points, 2, 1]]Construct multiple points along a geodesic, at regular distance intervals:
points = First@GeoDestination[{70, 0}, {Range[0, 1000000, 100000], 90}]Bearing does not stay constant along a geodesic:
GeoDirection@@@Partition[points, 2, 1]GeoDirection is not a smooth function for nearly antipodal points:
f[ϕ_ ? NumericQ, λ_ ? NumericQ] := QuantityMagnitude@GeoDirection[GeoPosition[{30, 0}], GeoPosition[{ϕ, λ}]]Plot[f[-30, λ], {λ, -181, -179}]Plot3D[f[ϕ, λ], {λ, -181, -179}, {ϕ, -29, -31}, Exclusions -> {{λ == -180, ϕ < -30}}]Compare with the corresponding results on the surface of a sphere:
fsph[ϕ_ ? NumericQ, λ_ ? NumericQ] := QuantityMagnitude@GeoDirection[GeoPosition[{30, 0}, 1], GeoPosition[{ϕ, λ}, 1]]Plot[fsph[-30, λ], {λ, -181, -179}]Plot3D[fsph[ϕ, λ], {λ, -181, -179}, {ϕ, -29, -31}, Exclusions -> {{λ == -180, ϕ < -30}}]Initial bearings of geodesics connecting antipodal pairs of points are complementary:
p = GeoPosition[{35.1, 75.7}];
q = GeoPosition[{60.4, 130.9}];α = GeoDirection[p, q]ap = GeoAntipode[p];
aq = GeoAntipode[q];β = GeoDirection[ap, aq]α + β{GeoGraphics[{Arrow[GeoPath[{p, q}]], PointSize[Large], Red, Point[p], Green, Point[q]}],
GeoGraphics[{Arrow[GeoPath[{ap, aq}]], PointSize[Large], Red, Point[ap], Green, Point[aq]}]}Related Guides
Text
Wolfram Research (2008), GeoDirection, Wolfram Language function, https://reference.wolfram.com/language/ref/GeoDirection.html (updated 2014).
CMS
Wolfram Language. 2008. "GeoDirection." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/GeoDirection.html.
APA
Wolfram Language. (2008). GeoDirection. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GeoDirection.html
BibTeX
@misc{reference.wolfram_2026_geodirection, author="Wolfram Research", title="{GeoDirection}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/GeoDirection.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_geodirection, organization={Wolfram Research}, title={GeoDirection}, year={2014}, url={https://reference.wolfram.com/language/ref/GeoDirection.html}, note=[Accessed: 13-June-2026]}