Difference between revisions of "Template:Deg2DMS/doc"

From blackwiki
Jump to navigation Jump to search
imported>Tom.Reding
m (→‎Usage: ce & WL)
(→‎Usage: Explain |sup=ms in a more straightforward way)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 +
{{High-use| 3,000 }}
 
== Description ==
 
== Description ==
  
This template converts a positive decimal degree value to ''degrees''°&nbsp;''minutes''&apos;&nbsp;''seconds''&apos;&apos; format or to ''degrees''°&nbsp;''minutes''<sup>m</sup>&nbsp;''seconds''<sup>s</sup> format (the degree symbol <code>°</code> is invariant between the two).
+
This template converts a positive [[decimal degree]] value to ''[[Degree (angle)|degrees]]''°&nbsp;''[[Minute and second of arc|minutes]]''&apos;&nbsp;''[[Minute and second of arc|seconds]]''&apos;&apos; format or to ''degrees''°&nbsp;''minutes''<sup>m</sup>&nbsp;''seconds''<sup>s</sup> format (the degree symbol <code>°</code> is invariant between the two formats).
  
 
== Usage ==
 
== Usage ==
Line 9: Line 10:
 
<code><nowiki>{{Deg2DMS|</nowiki>''positive decimal degrees''<nowiki>|p=</nowiki>''precision''<nowiki>|sup=</nowiki>''ms''<nowiki>}}</nowiki></code>.<br>
 
<code><nowiki>{{Deg2DMS|</nowiki>''positive decimal degrees''<nowiki>|p=</nowiki>''precision''<nowiki>|sup=</nowiki>''ms''<nowiki>}}</nowiki></code>.<br>
  
Parameter '''p''' is optional and defaults to 3.<br>
+
Parameter '''p''' is optional and defaults to 3.  It is the number of decimal digits that the seconds are rounded to.<br>
Parameter '''sup''' is optional and defaults to not-used, <blank>, or <null>, which produces the apostrophe-format for [[arcminute]]s and [[arcsecond]]s, by default ({{Deg2DMS|1.0342|p=0}}). It may be activated by "ms", or any text, to produce the m-s-format for arcminutes and arcseconds ({{Deg2DMS|1.0342|p=0|sup=ms}}).
+
Parameter '''sup''' is optional and changes the default apostrophe-format for [[arcminute]]s and [[arcsecond]]s ({{Deg2DMS|1.0342|p=0}}) to the m-s-format for arcminutes and arcseconds ({{Deg2DMS|1.0342|p=0|sup=ms}}).  Any non-blank value has this effect, but using {{para|sup|ms}} is customary.
  
 
For example:<br>
 
For example:<br>
 +
 +
<code><nowiki>{{Deg2DMS|266.416837}}</nowiki></code> returns {{Deg2DMS|266.416837}}.<br>
 
<code><nowiki>{{Deg2DMS|266.416837|p=4}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4}}.<br>
 
<code><nowiki>{{Deg2DMS|266.416837|p=4}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4}}.<br>
 
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup= }}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup= }}.<br>
 
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup= }}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup= }}.<br>
  
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup=ms}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup=yes}}.<br>
+
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup=ms}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup=ms}}.<br>
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup=no}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup=y}}.<br>
+
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup=no}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup=no}}.<br>
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup=10}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup=no}}.<br>
+
<code><nowiki>{{Deg2DMS|266.416837|p=4|sup=''}}</nowiki></code> returns {{Deg2DMS|266.416837|p=4|sup=''}}.<br>
  
 
==See also==
 
==See also==
 
{{Math templates|conversion}}
 
{{Math templates|conversion}}
  
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
+
<includeonly>{{Sandbox other||
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
[[Category:Numerical conversion templates|{{PAGENAME}}]]
 
[[Category:Numerical conversion templates|{{PAGENAME}}]]
 
[[Category:Convert-like templates|{{SUBPAGENAME}}]]
 
[[Category:Convert-like templates|{{SUBPAGENAME}}]]
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 07:23, 19 November 2020

Description

This template converts a positive decimal degree value to degrees° minutesseconds'' format or to degrees° minutesm secondss format (the degree symbol ° is invariant between the two formats).

Usage

{{Deg2DMS|positive decimal degrees|p=precision|sup=ms}}.

Parameter p is optional and defaults to 3. It is the number of decimal digits that the seconds are rounded to.
Parameter sup is optional and changes the default apostrophe-format for arcminutes and arcseconds (1° 2′ 3″) to the m-s-format for arcminutes and arcseconds (1° 2m 3s). Any non-blank value has this effect, but using |sup=ms is customary.

For example:

{{Deg2DMS|266.416837}} returns 266° 25′ 0.613″.
{{Deg2DMS|266.416837|p=4}} returns 266° 25′ 0.6132″.
{{Deg2DMS|266.416837|p=4|sup= }} returns 266° 25′ 0.6132″.

{{Deg2DMS|266.416837|p=4|sup=ms}} returns 266° 25m 0.6132s.
{{Deg2DMS|266.416837|p=4|sup=no}} returns 266° 25m 0.6132s.
{{Deg2DMS|266.416837|p=4|sup=''}} returns 266° 25m 0.6132s.

See also