Difference between revisions of "Template:Coord/dec2dms"

From blackwiki
Jump to navigation Jump to search
imported>Quarl
(«+"|"»)
imported>Quarl
(«"3600" → "60", "3600" → "60"»)
Line 3: Line 3:
 
     |d={{#expr:{{{1}}} round 0}}°
 
     |d={{#expr:{{{1}}} round 0}}°
 
     |dm={{#expr:{{{1}}} round 0}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′
 
     |dm={{#expr:{{{1}}} round 0}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′
     |dms={{#expr:{{{1}}} round 0}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′{{#expr:{{{1}}} * 3600 mod 3600 round 1}}″}} {{{2}}}
+
     |dms={{#expr:{{{1}}} round 0}}°{{#expr:{{{1}}} * 60 mod 60 round 0}}′{{#expr:{{{1}}} * 3600 mod 60 round 1}}″}} {{{2}}}
 
   |{{#switch:{{{prec}}}
 
   |{{#switch:{{{prec}}}
 
     |d={{#expr:-{{{1}}} round 0}}°
 
     |d={{#expr:-{{{1}}} round 0}}°
 
     |dm={{#expr:-{{{1}}} round 0}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′
 
     |dm={{#expr:-{{{1}}} round 0}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′
     |dms={{#expr:-{{{1}}} round 0}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′{{#expr:-{{{1}}} * 3600 mod 3600 round 1}}″}} {{{3}}}}}</includeonly><noinclude>{{template doc}}</noinclude>
+
     |dms={{#expr:-{{{1}}} round 0}}°{{#expr:-{{{1}}} * 60 mod 60 round 0}}′{{#expr:-{{{1}}} * 3600 mod 60 round 1}}″}} {{{3}}}}}</includeonly><noinclude>{{template doc}}</noinclude>

Revision as of 05:34, 18 March 2007

Template documentation[view] [edit] [history] [purge]

Given a decimal coordinate, two cardinal directions, and precision, render a coordinate in degrees/minutes/seconds.

Usage

{{coord/dec2dms|coord|N|S|precision}}
{{coord/dec2dms|coord|E|W|precision}}

Precision codes:

dDegrees (rounded to integer)
d1Degrees (rounded to 0.1 degrees)
dmDegrees, minutes (rounded to integer)
dm1Degrees, minutes (rounded to 0.1 minutes)
dmsDegrees, minutes, seconds (rounded to integer)
dms1Degrees, minutes, seconds (rounded to 0.1 seconds)

Examples

{{Coord/dec2dms|10.391944|N|S|d}} N
{{Coord/dec2dms|10.391944|N|S|d1}} N
{{Coord/dec2dms|10.390000|N|S|d}} N
{{Coord/dec2dms|10.390000|N|S|d1}} N
{{Coord/dec2dms|10.39|N|S|d}} N
{{Coord/dec2dms|10.39|N|S|d1}} N
{{Coord/dec2dms|-10.391944|N|S|dm}} S
{{Coord/dec2dms|-10.391944|N|S|dm1}} S
{{Coord/dec2dms|10.391944|E|W|dms}} E
{{Coord/dec2dms|10.391944|E|W|dms1}} E
{{Coord/dec2dms|10|N|S|d}} N
{{Coord/dec2dms|10|E|W|dm}} E
{{Coord/dec2dms|-10|E|W|dms}} W
{{Coord/dec2dms|-10|E|W|dms1}} W

Subroutines

Subroutines of Template:Coord/dec2dms (edit | talk | history | links | watch | logs):