Calculate Distance Between Two Points in Geographic Space

When Mapping Toolbox™ functions calculate the distance between two points in geographic space, the result depends upon whether you specify great circle or rhumb line distance. The distance function returns the appropriate distance between two points as an angular arc length, employing the same angular units as the input latitudes and longitudes. The default path type is the shorter great circle, and the default angular units are degrees. The previous figure shows two points at (15°S, 0°) and (60°N, 150°E). The great circle distance between them, in degrees of arc, is as follows:

distgc = distance(-15,0,60,150)

distgc =
  	129.9712

The rhumb line distance is greater:

distrh = distance('rh',-15,0,60,150)

distrh =
  	145.0288

To determine how much longer the rhumb line path is in, say, kilometers, you can use a distance conversion function on the difference:

kmdifference = deg2km(distrh-distgc)

kmdifference =
  	1.6744e+03

Several distance conversion functions are available in the toolbox, supporting degrees, radians, kilometers, meters, statute miles, nautical miles, and feet. Converting distances between angular arc length units and surface length units requires the radius of a planet or spheroid. By default, the radius of the Earth is used.