Mapping Toolbox | ![]() ![]() |
Compute azimuth between two points on the globe
Syntax
az = azimuth(pt1,pt2) az = azimuth(pt1,pt2,geoid) az = azimuth(pt1,pt2,units) az = azimuth(pt1,pt2,geoid,units) az = azimuth(track,pt1,...) az = azimuth(lat1,lon1,lat2,lon2) az = azimuth(lat1,lon1,lat2,lon2,geoid) az = azimuth(lat1,lon1,lat2,lon2,units) az = azimuth(lat1,lon1,lat2,lon2,geoid,units) az = azimuth(track,lat1,...)
Background
Azimuths are the bearings, or directions, between pairs of points. Azimuths are measured as angles, clockwise from true north. The North Pole has an azimuth of 0º from every other point on the globe.
Azimuth can be calculated in two manners. For great circles, the azimuth is the angle made between true north and the great circle passing through the two points at the first point. For rhumb lines, the azimuth is the constant angle made between true north and the entire rhumb line passing through the two points. For more information on this distinction, see the Mapping Toolbox User's Guide.
Description
az = azimuth(pt1,pt2) calculates the great circle azimuths from pt1
to pt2
. These two-column matrices should be of the form [latitude longitude]
.
az = azimuth(lat1,lon1,lat2,lon2) performs the same calculation for two pairs of latitude and longitude matrices.
az = azimuth(pt1,pt2,geoid) specifies the elliptical definition of the Earth to be used with the two-element geoid
vector. The default geoid model is a unit sphere, which is sufficient for most applications.
az = azimuth(pt1,pt2,units
) specifies the standard angle unit string. The default value is 'degrees'
.
az = azimuth(track,pt1,...) specifies whether great circle azimuths or rhumb line azimuths are desired. Great circle azimuths, the default, are indicated with the standard track
string 'gc'
. Rhumb line azimuths are indicated with the standard track
string 'rh'
.
Examples
Consider two points on the same parallel, for example, (10ºN,10ºE) and (10ºN,40ºE). The azimuth between these two points depends upon the track
string selected. Using the pt1,pt2
notation, the two cases result in:
The great circle path begins on an azimuth north of east to take the shortest route to the second point; the rhumb line proceeds along the parallel, on a constant due east heading.
Rhumb lines and great circles coincide along meridians and the Equator. Consider two points on the same meridian, say (10ºN,10ºE) and (40ºN,10ºE); this time using the lat1,lon1,lat2,lon2
notation:
The azimuths are the same because the paths coincide.
See Also
distance |
Distance between points |
elevation |
Elevation angle to a point |
reckon |
New point from an azimuth and |
track track1 track2 |
Tracing paths on the globe |
![]() | axesscale | bufferm | ![]() |