DMSString

DMSString[θ]

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

DMSString[{ϕ,λ}]

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

DMSString[{d,m,s}]

converts a DMS list to a DMS string.

Details

  • 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.

Examples

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:

Wolfram Research (2008), DMSString, Wolfram Language function, https://reference.wolfram.com/language/ref/DMSString.html (updated 2014).

Text

Wolfram Research (2008), DMSString, Wolfram Language function, https://reference.wolfram.com/language/ref/DMSString.html (updated 2014).

CMS

Wolfram Language. 2008. "DMSString." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/DMSString.html.

APA

Wolfram Language. (2008). DMSString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DMSString.html

BibTeX

@misc{reference.wolfram_2024_dmsstring, author="Wolfram Research", title="{DMSString}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DMSString.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_dmsstring, organization={Wolfram Research}, title={DMSString}, year={2014}, url={https://reference.wolfram.com/language/ref/DMSString.html}, note=[Accessed: 22-November-2024 ]}