Difference between revisions of "Template:Graticule"

From Geohashing
imported>Duskwolf
(adding maponly parameter - hides everything but the map)
 
(27 intermediate revisions by 12 users not shown)
Line 1: Line 1:
<table class="infobox" cellspacing="5" style="width: 22em; text-align: left; font-size: 88%; line-height: 1.5em; border: 1px solid #aaa; background-color: #f9f9f9; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right;">
+
<includeonly><table class="infobox" cellspacing="5" style="width: 22em; text-align: left; font-size: 88%; line-height: 1.5em; border: 1px solid #aaa; background-color: #f9f9f9; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right;">
 
{{#if:{{{maponly|}}}|| <!-- Put any extra headings below here. -->
 
{{#if:{{{maponly|}}}|| <!-- Put any extra headings below here. -->
 +
{{#vardefine:n|{{#switch:{{{lat|0}}}|-1=-0|-0=0|{{#expr:({{{lat|0}}} + 1)}} }} }}
 +
{{#vardefine:e|{{#switch:{{{lon|0}}}|-1=-0|-0=0|{{#expr:({{{lon|0}}} + 1)}} }} }}
 +
{{#vardefine:s|{{#switch:{{{lat|0}}}|0=-0|{{#expr:({{{lat|0}}} - 1)}} }} }}
 +
{{#vardefine:w|{{#switch:{{{lon|0}}}|0=-0|{{#expr:({{{lon|0}}} - 1)}} }} }}
 
<tr>
 
<tr>
     <td style="text-align:center" width="7em"><b>{{#if:{{{nw|}}} | [[{{{nw}}}]] | - }}</b></td>
+
     <td style="text-align:left;width:7em" width="7em">'''{{#if:{{{nw|}}} | {{{nw}}} | [[{{#var:n}},{{#var:w}}|&ndash;]] }}'''</td>
     <td style="text-align:center" width="8em"><b>{{#if:{{{n|}}} | [[{{{n}}}]] | - }}</b></td>
+
     <td style="text-align:center;width:8em" width="8em">'''{{#if:{{{n|}}} | {{{n}}} | [[{{#var:n}},{{{lon|0}}}|&ndash;]] }}'''</td>
     <td style="text-align:center" width="7em"><b>{{#if:{{{ne|}}} | [[{{{ne}}}]] | - }}</b></td>
+
     <td style="text-align:right;width:7em" width="7em">'''{{#if:{{{ne|}}} | {{{ne}}} | [[{{#var:n}},{{#var:e}}|&ndash;]] }}'''</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
     <td style="text-align:center"><b>{{#if:{{{w|}}} | [[{{{w}}}]] | - }}</b></td>
+
     <td style="text-align:left;width:7em" width="7em">'''{{#if:{{{w|}}} | {{{w}}} | [[{{{lat|0}}},{{#var:w}}|&ndash;]] }}'''</td>
     <td style="text-align:center"><b>{{{name|{{PAGENAME}}}}}</b></td>
+
     <td style="text-align:center;width:8em" width="8em">'''{{{name|{{PAGENAME}}}}}'''</td>
     <td style="text-align:center"><b>{{#if:{{{e|}}} | [[{{{e}}}]] | - }}</b></td>
+
     <td style="text-align:right;width:7em" width="7em">'''{{#if:{{{e|}}} | {{{e}}} | [[{{{lat|0}}},{{#var:e}}|&ndash;]] }}'''</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
     <td style="text-align:center"><b>{{#if:{{{sw|}}} | [[{{{sw}}}]] | - }}</b></td>
+
     <td style="text-align:left;width:7em" width="7em">'''{{#if:{{{sw|}}} | {{{sw}}} | [[{{#var:s}},{{#var:w}}|&ndash;]] }}'''</td>
     <td style="text-align:center"><b>{{#if:{{{s|}}} | [[{{{s}}}]] | - }}</b></td>
+
     <td style="text-align:center;width:8em" width="8em">'''{{#if:{{{s|}}} | {{{s}}} | [[{{#var:s}},{{{lon|0}}}|&ndash;]] }}'''</td>
     <td style="text-align:center"><b>{{#if:{{{se|}}} | [[{{{se}}}]] | - }}</b></td>
+
     <td style="text-align:right;width:7em" width="7em">'''{{#if:{{{se|}}} | {{{se}}} | [[{{#var:s}},{{#var:e}}|&ndash;]] }}'''</td>
 
</tr>
 
</tr>
<!-- Put any additional fields above here.
+
<!-- Put any additional fields above here. -->}}
-->}}
+
<tr><td colspan="3" style="text-align:center;">{{{map| {{#ifeq:{{{point|0}}}|1
<tr><td colspan="3" style="text-align:center;">{{{map|<includeonly><span style='font-size: 125%; color:red'>'''No map available.'''</span></includeonly><noinclude><map lat="51" lon="0" /></noinclude>}}}</td></tr>
+
|{{#vardefine:ymd|{{#time:Y-m-d| +{{#expr:({{{lon|0}}} * 12 / 180) round 0}} hours}} }}
</table><noinclude>
+
{{#tag:map||lat={{{lat|0}}}|lon={{{lon|0}}}|date={{#var:ymd}} }}<br>
Usage:
+
[[{{#var:ymd}}|{{#time:D j M Y|{{#var:ymd}} }}]] in [[{{{lat|0}}},{{{lon|0}}}]]:<br>
 
+
'''{{coordinates graticule|{{#var:ymd}}|lat={{{lat|0}}}|lon={{{lon|0}}} }}'''<br>
  <nowiki>{{</nowiki>graticule
+
|{{#tag:map||lat={{{lat|0}}}|lon={{{lon|0}}} }}
    | map = <nowiki><map lat="123" lon="-45" /></nowiki>
+
}} }}}
    | nw = Smalltown, USA
+
{{#if:{{{lat|}}}|Today's location: {{meetup links||lat={{{lat}}}|lon={{{lon}}}}}}}
    | s = Hayfields, USA
+
</td></tr>
  }}
+
</table>{{#if:{{{nocategory|}}}||[[Category:Meetup in {{{lat}}} {{{lon}}}| ]]}}</includeonly><noinclude>
 
+
{{Graticule/Documentation}} <!-- Documentation is elsewhere -->
Make sure to not leave out the trailing slash on the <nowiki><map... /></nowiki>. Ideally, I'd like to avoid using <nowiki><map></nowiki> at all, but <nowiki>{{#tag}}</nowiki> doesn't seem to want to do the right thing here. [[User:Duskwolf|Duskwolf]] 00:22, 22 May 2008 (UTC)
 
 
</noinclude>
 
</noinclude>

Latest revision as of 20:02, 5 April 2024

Usage:

{{graticule
|lat = 50
|lon = -1
|n = [[Swindon, United Kingdom]]
|sw = [[Channel Islands]]
}}

Swindon, United Kingdom
Graticule
Channel Islands

Today's location: geohashing.info google osm bing/os kml crox

Notes on usage:

  • You don't have to include neighbors that don't exist. The template will automatically insert a "-" for absent neighbors.
  • You can automatically abbreviate links using the magic pipe: insert a | character at the end of the bracketed text: [[Smalltown, USA|]] is magically transformed (at save time) to [[Smalltown, USA|Smalltown]].
  • You can add a "| maponly = 1" if you just want the map without the links to the surrounding graticules.

All articles using this template should use wikilink brackets ([[ and ]]) to link to the other neighboring graticules. Please don't change this article to link automatically, since neighboring graticules might have unwieldy names that would make more sense to be shortened (ie by using "[[Minneapolis SW, Minnesota|Minneapolis SW]]"). Work has been done to change existing articles to link to neighbors by the template user and not by the template. Ironiridis 21:56, 22 May 2008 (UTC)


Edit the documentation (it isn't part of the template page)