Length and Distance Units

Linear measurements of lengths and distances on spheres and spheroids can use the same units they do on the plane, such as feet, meters, miles, and kilometers. They can be used for

  • Absolute positions, such as map coordinates or terrain elevations

  • Dimensions, such as a planet’s radius or its semimajor and semiminor axes

  • Distances between points or along routes, in 2-D or 3-D space or across terrain

Length units are needed to describe

  • The dimensions of a reference sphere or ellipsoid

  • The line-of-sight distance between points

  • Distances along great circle or rhumb line curves on an ellipsoid or sphere

  • X-Y locations in a projected coordinate system or map grid

  • Offsets from a map origin (false eastings and northings)

  • X-Y-Z locations in Earth-centered Earth-fixed (ECEF) or local vertical systems

  • Heights of various types (terrain elevations above a geoid, an ellipsoid, or other reference surface)

Choosing Units of Length

Using the toolbox effectively depends on being consistent about units of length. Depending on the specific function and the way you are calling it, when you specify lengths, you could be

  • Explicitly specifying a radius, reference spheroid object, or ellipsoid vector

  • Relying on the function itself to specify a default radius or ellipsoid

  • Relying on the reference ellipsoid associated with a map projection structure (mstruct)

Whenever you are doing a computation that involves a reference sphere or ellipsoid, make sure that the units of length you are using are the same units used to define the radius of the sphere or semimajor axis of the ellipsoid. These considerations are discussed below.

Converting Units of Length

The following Mapping Toolbox™ functions convert between different units of length:

  • unitsratio computes multiplicative factors for converting between 12 different units of length as well as between degrees and radians. You can use unitsratio to perform conversions when neither the input units of length nor the output units of length are known until run time. See Converting Angle Units that Vary at Run Time for more information.

  • km2nm, km2sm, nm2km, nm2sm, sm2km, and sm2nm perform simple and convenient conversions between kilometers, nautical miles, and statute miles.

These utility functions accept scalars, vectors, and matrices, or any shape. For an overview of these functions and angle conversion functions, see Summary: Available Distance and Angle Conversion Functions.