DMSString
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 all close allBasic Examples (3)
Convert an angle given in decimal degrees to a DMS string:
DMSString[20.53773]Convert to a DMS string that specifies one of the cardinal directions:
DMSString[{-20, -3, -10}, "NS"]Convert a {lat, lon} pair in degrees to a double DMS string with cardinal directions:
DMSString[{40.0972, -88.2461}]Scope (5)
Convert a DMS list into a DMS string:
DMSString[{27, 12, 3.45}]For exact input, the result also contains exact numbers:
DMSString[{27, 12, 3}]By default, DMSString ignores signs:
DMSString[{-27, -12, -3.45}]DMSString[{27, 12, 3.45, "S"}]They can be kept by using cardinal directions, either for latitude ("NS") or for longitude ("EW"):
DMSString[{-27, -12, -3.45}, "NS"]DMSString[{-27, -12, -3.45}, "EW"]DMSString[{27, 12, 3.45}, "NS"]DMSString[{27, 12, 3.45}, "EW"]DMSString[{27, 12, 3.45, "S"}, "NS"]DMSString[{27, 12, 3.45, "S"}, "EW"]Convert a numeric angle in degrees into a DMS string:
DMSString[123.34134]DMSString[-123.34134, "NS"]By default, DMSString produces numbers with three decimals for seconds:
DMSString[189.34313]The number of digits can be decreased or increased:
DMSString[189.34313, 5]DMSString[-189.34313, {"EW", 0}]DMSString[189.34313, {"NS", 10}]The precision parameter only affects the results of inexact inputs:
DMSString[189, 10]Convert a {lat, lon} pair in degrees to a double DMS string:
DMSString[{50.683, -88.121}]Specify the number of decimals to be shown for seconds:
DMSString[{50.683, -88.121}, 1]Generalizations & Extensions (3)
On DMS strings, DMSString returns a canonical form:
DMSString["23d11m49.92s North"]The choice of cardinal direction is still free:
DMSString["23d11m49.92s South", "EW"]Act on a GeoPosition object, returning a pair "lat long":
$GeoLocation%//DMSStringConvert a Quantity angle into a DMS string:
DMSString[Quantity[3.342387, "Radians"]]DMSString[Quantity[-1.342387, "Radians"], "EW"]Properties & Relations (3)
If the input contains any inexact number, the result will be inexact, always in the seconds:
DMSString[{20., 10, 12}]DMSString[{20, 10., 12}]Only when all numbers are exact will the result be exact:
DMSString[{20, 10, 12}]DMSString[2017 / 100, "EW"]The action of DMSString on a DMS list can be inverted with DMSList:
DMSString[{34, 23, 14.78}]DMSList[%]DMSString[{34, 23, 15}]DMSList[%]The action of DMSString on a numeric angle in degrees can be inverted with FromDMS:
DMSString[34.3873]FromDMS[%]With exact numbers, DMSString returns a numerical approximation:
DMSString[343873 / 10000]Hence the original exact number cannot be directly recovered:
FromDMS[%]Rationalize[%]See Also
DMSList FromDMS LatitudeLongitude Degree GeodesyData GeoPosition GeoDistance
Function Repository: GeneralizedDMSString
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_2026_dmsstring, author="Wolfram Research", title="{DMSString}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DMSString.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_dmsstring, organization={Wolfram Research}, title={DMSString}, year={2014}, url={https://reference.wolfram.com/language/ref/DMSString.html}, note=[Accessed: 12-June-2026]}