Mapping Toolbox | ![]() ![]() |
Convert distance from degrees to kilometers, nautical miles, or statute miles
Syntax
distout = deg2km(distin) distout = deg2km(distin,radius) distout = deg2nm(distin) distout = deg2nm(distin,radius) distout = deg2sm(distin) distout = deg2sm(distin,radius)
Description
distout = deg2km(distin) converts the input distance given in degrees to kilometers.
distout = deg2nm(distin)and distout = deg2sm(distin)work identically, except that the output units are nautical miles and statute miles, respectively.
distout = deg2km(distin,radius)specifies the radius of the sphere to use, since a degree of arc length covers less distance, for example, on Mars than it would on the Earth. You can enter the radius as a number in kilometers, as a call to the almanac
function (e.g., almanac('mars','radius','km')
), again in the appropriate units, or you can pass in a string planet name (e.g., 'mars'
), and the function will make the appropriate call to the almanac
function. The radius of the Earth is the default.
For distout = deg2nm(distin,radius)and distout = deg2sm(distin,radius), make sure your input radius is in the appropriate units, or just use the planet name string.
Examples
A degree of arc length is about 60 nautical miles:
This is not true on Mercury, of course:
See Also
deg2rad |
Convert degrees to radians |
distdim |
Convert distance units |
nm2km sm2deg |
Other direct distance conversion functions |
![]() | deg2dms, deg2dm | deg2rad | ![]() |