Main Content

Lengths and Angles

Convert between different angle and length units and perform longitude wrapping; convert units of distances along the surface of the Earth

On a perfect sphere, the distance between points on the surface of the sphere can be represented by angles. For spherical models of the Earth, Moon, and other planetary bodies, Mapping Toolbox™ allows spherical distance conversion between common units of angles and length.

Functions

expand all

Convert Degrees and Radians

deg2rad Convert angle from degrees to radians
rad2deg Convert angle from radians to degrees

Convert Notations

degrees2dm Convert degrees to degrees-minutes
degrees2dms Convert degrees to degrees-minutes-seconds
dm2degrees Convert degrees-minutes to degrees
dms2degrees Convert degrees-minutes-seconds to degrees

Convert Degrees and Radians at Run-Time

toDegrees Convert angles to degrees
toRadians Convert angles to radians
fromDegrees Convert angles from degrees
fromRadians Convert angles from radians
wrapTo180 包角的度(-180 180)
wrapTo360 Wrap angle in degrees to [0 360]
wrapToPi Wrap angle in radians to [−pi pi]
wrapTo2Pi Wrap angle in radians to [0 2*pi]
unwrapMultipart Unwrap angles with parts separated byNaNvalues
km2nm Convert kilometers to nautical miles
km2sm Convert kilometers to statute miles
nm2km Convert nautical miles to kilometers
nm2sm Convert nautical to statute miles
sm2km 转换statute miles to kilometers
sm2nm 转换statute to nautical miles
deg2km Convert spherical distance from degrees to kilometers
deg2nm Convert spherical distance from degrees to nautical miles
deg2sm Convert spherical distance from degrees to statute miles
km2deg Convert spherical distance from kilometers to degrees
km2rad Convert spherical distance from kilometers to radians
nm2deg Convert spherical distance from nautical miles to degrees
nm2rad Convert spherical distance from nautical miles to radians
rad2km Convert spherical distance from radians to kilometers
rad2nm Convert spherical distance from radians to nautical miles
rad2sm Convert spherical distance from radians to statute miles
sm2deg Convert spherical distance from statute miles to degrees
sm2rad Convert spherical distance from statute miles to radians
str2angle Convert strings to angles in degrees
angl2str Convert angles to character array
map.geodesy.isDegree True if input matches'degree'and false if'radian'
validateLengthUnit Validate and standardize length unit
unitsratio Conversion factor between units

Topics

Angles

Lengths

  • Length and Distance Units
    Linear measurements of arc lengths and distances on spheroids use the same units as on the plane, such as feet, meters, miles, and kilometers.

Spherical Distance

  • Distances on the Sphere
    You can represent distances on the sphere using angles or linear arc lengths.
  • Relationship Between Points on Sphere
    There are many ways to define the 2-D spatial relationship between two points on a perfect sphere, including azimuth, heading, spherical distance, linear distance, and range.