Template:Coord/dec2dms: Difference between revisions

From ScoutWiki, For Everyone, Everywhere involved with Scouting and Guiding...
Jump to navigation Jump to search
m (Robot: Removing from Category:Coord template)
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<includeonly>{{#ifexpr:{{{1}}} >= 0
<includeonly>{{Coord/dec2dms/{{{4}}}|{{#ifexpr:{{{1}}} >= 0||-}}{{{1}}}}}{{#ifexpr:{{{1}}} >= 0|{{{2}}}|{{{3}}}}}</includeonly><noinclude>{{pp-template|small=yes}}{{template doc}}</noinclude>
  |{{#switch:{{{4}}}
    |d={{#expr:{{{1}}} round 1}}°
    |dm={{#expr:{{{1}}} mod 360}}°{{#expr:({{{1}}} * 600 round 0) mod 600 / 10}}′
    |dms={{#expr:{{{1}}} mod 360}}°{{#expr:{{{1}}} * 60 mod 60}}′{{#expr:({{{1}}} * 36000 round 0) mod 600 / 10}}″
    |#default=ERROR, missing precision}} {{{2}}}
  |{{#switch:{{{4}}}
    |d={{#expr:-{{{1}}} round 1}
    |dm={{#expr:-{{{1}}} mod 360}}°{{#expr:(-{{{1}}} * 600 round 0) mod 600 / 10}}′
    |dms={{#expr:-{{{1}}} mod 360}}°{{#expr:-{{{1}}} * 60 mod 60}}′{{#expr:(-{{{1}}} * 36000 round 0) mod 600 / 10}}″
    |#default=ERROR, missing precision}} {{{3}}}}}</includeonly><noinclude><!--
 
The "mod 360" is necessary to truncate degrees.  "round 0" is different because it rounds rather than truncates.
 
-->{{template doc}}</noinclude>

Latest revision as of 12:39, 7 May 2012