converts an angle θ given in decimal degrees to a degrees-minutes-seconds string.


converts latitude and longitude given in decimal degrees to a DMS latitude-longitude string.


converts a DMS list to a DMS string.


  • DMSString[θ,"NS"] or DMSString[θ,"EW"] gives a string representation in which the sign of the angle is indicated by one of the cardinal directions "N", "S", "E", or "W".
  • DMSString[{ϕ,λ}] uses "N" for positive ϕ and "E" for positive λ.
  • DMSString[θ,n] uses n-digit precision for seconds. DMSString[θ,{"XY",n}] defines both sign representation and precision.
  • Angles in radians can be converted to degrees for use in DMSString by dividing by Degree.


open allclose all

Basic Examples  (2)

Convert an angle given in decimal degrees to a DMS string:

Convert to a DMS string that specifies one of the cardinal directions:

Scope  (4)

Convert a DMS list into a DMS string:

For exact input, the result also contains exact numbers:

By default, DMSString ignores signs:

They can be kept by using cardinal directions, either for latitude ("NS") or for longitude ("EW"):

Convert a numeric angle in degrees into a DMS string:

A signed angle:

By default, DMSString produces numbers with three decimals for seconds:

The number of digits can be decreased or increased:

The precision parameter only affects the results of inexact inputs:

Generalizations & Extensions  (3)

On DMS strings, DMSString returns a canonical form:

The choice of cardinal direction is still free:

Act on a GeoPosition object, returning a pair "lat long":

Convert a Quantity angle into a DMS string:

Properties & Relations  (3)

If the input contains any inexact number, the result will be inexact, always in the seconds:

Only when all numbers are exact will the result be exact:

The action of DMSString on a DMS list can be inverted with DMSList:

With exact numbers:

The action of DMSString on a numeric angle in degrees can be inverted with FromDMS:

With exact numbers, DMSString returns a numerical approximation:

Hence the original exact number cannot be directly recovered:

Introduced in 2008
Updated in 2014