Difference between revisions of "Template:LocFormat"

From BITPlan E-Bike Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
Template to format coordinates in decimal degrees with optional transport.
+
Template to format coordinates see https://maps.extension.wiki/wiki/Coordinate_formats.
==== Usage ====
+
Default is decimal degrees.
 +
 
 +
= Usage =
 
<pre>{{LocFormat
 
<pre>{{LocFormat
 
|coordinates
 
|coordinates
 
|format=dd
 
|format=dd
|transport=bike}}</pre>
+
|directional=yes}}</pre>
 +
 
 +
== 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 ====
+
= Examples =
* Without transport:
 
{{LocFormat|43° 16' 28.74" N, 2° 1' 16.69" W}}
 
→ 43.27465, -2.02130
 
  
* With transport:
+
{| class="wikitable"
{{LocFormat|43° 16' 28.74" N, 2° 1' 16.69" W|transport=train}}
+
! Format !! Example !! colspan="2" | Direction
→ 43.27465, -2.02130:train
+
|-
 +
! !! !! 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}}{{#if:{{{transport|}}}|:{{{transport|}}}|}}</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"