Difference between revisions of "Template:LocFormat"

From BITPlan E-Bike Wiki
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
Default is decimal degrees.
 
Default is decimal degrees.
  
==== Usage ====
+
= Usage =
 
<pre>{{LocFormat
 
<pre>{{LocFormat
 
|coordinates
 
|coordinates
 
|format=dd
 
|format=dd
|directional=no}}</pre>
+
|directional=yes}}</pre>
==== Parameters ====
+
 
 +
== Parameters ==
 
* {{{1}}}: The coordinate string to format
 
* {{{1}}}: The coordinate string to format
 
* format: Output format - one of float, dd (decimal degrees), dm (decimal minutes) or dms (degrees minutes seconds)
 
* format: Output format - one of float, dd (decimal degrees), dm (decimal minutes) or dms (degrees minutes seconds)
 
* directional: Whether to show direction indicators (N/S/E/W) - default is yes
 
* directional: Whether to show direction indicators (N/S/E/W) - default is yes
  
==== Examples ====
+
= Examples =
=== Floats (format=float) ===
 
* {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=float}}
 
→ 55.7557860, -37.6176330
 
 
 
=== Decimal Degrees (format=dd) ===
 
* {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dd}}
 
→ 55.7557860°, -37.6176330°
 
 
 
=== Decimal Minutes (format=dm) ===
 
* {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dm}}
 
→ 55° 45.3472', -37° 37.0580'
 
  
=== Degrees Minutes Seconds (format=dms) ===
+
{| class="wikitable"
* {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dms}}
+
! Format !! Example !! colspan="2" | Direction
55° 45' 20.83", -37° 37' 3.48"
+
|-
 +
! !! !! Yes !! No
 +
|-
 +
| float
 +
| <pre>{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=float|directional=yes}}</pre>
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=float}}
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=float|directional=no}}
 +
|-
 +
| dd
 +
| <pre>{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dd|directional=yes}}</pre>
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dd}}
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dd|directional=no}}
 +
|-
 +
| dm
 +
| <pre>{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dm|directional=yes}}</pre>
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dm}}
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dm|directional=no}}
 +
|-
 +
| dms  
 +
| <pre>{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dms|directional=yes}}</pre>
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dms}}  
 +
| {{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dms|directional=no}}
 +
|}
  
 
[[Category:Template]]
 
[[Category:Template]]
 
</noinclude>
 
</noinclude>
<includeonly>{{#coordinates:{{{1}}}|format={{{format|dd}}}|directional=yes}}</includeonly>
+
<includeonly>{{#coordinates:{{{1}}}|format={{{format|dd}}}|directional={{{directional|yes}}}}}</includeonly>

Latest revision as of 09:58, 19 January 2025

Template to format coordinates see https://maps.extension.wiki/wiki/Coordinate_formats. Default is decimal degrees.

Usage

{{LocFormat
|coordinates
|format=dd
|directional=yes}}

Parameters

  • {{{1}}}: The coordinate string to format
  • format: Output format - one of float, dd (decimal degrees), dm (decimal minutes) or dms (degrees minutes seconds)
  • directional: Whether to show direction indicators (N/S/E/W) - default is yes

Examples

Format Example Direction
Yes No
float
{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=float|directional=yes}}

55.755786 N, 37.617633 W

55.755786, -37.617633

dd
{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dd|directional=yes}}

55.755786° N, 37.617633° W

55.755786°, -37.617633°

dm
{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dm|directional=yes}}

55° 45.3472' N, 37° 37.0580' W

55° 45.3472', -37° 37.0580'

dms
{{LocFormat|55° 45' 20.83" N, 37° 37' 3.48" W|format=dms|directional=yes}}

55° 45' 20.83" N, 37° 37' 3.48" W

55° 45' 20.83", -37° 37' 3.48"