Difference between revisions of "Template:Coordinates"

From Pandorabox
Jump to navigation Jump to search
(Select map layer and add zoom parameter)
(Move "custom zoom" demo back below example code. Add info about map layer selection.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
=== Description ===
 
=== Description ===
  
I created this template and moved it to "Earth coordinates". I want it to do two things: be both human-readable and have a map link. - [[User:6r1d]]
+
Use this template to show inline coordinates on the map. I.e. embed them on some sentence with a distinct style, or, alternatively, embed in some other template.
 +
 
 +
Map layer will be automatically selected based on <code>y</code> parameter:
 +
 
 +
* y < 5000 for earth, map layer 0
 +
* y < 6000 for moon, map layer 1
 +
* y < 11000 for space, map layer 2
 +
* y 11000 and above for mars, map layer 3
  
 
=== Example ===
 
=== Example ===
  
 
Use following code:
 
Use following code:
<pre>{{Earth_coordinates |x=123 |y=234 |z=345}}</pre>
+
<pre>{{Coordinates |x=123 |y=234 |z=345}}</pre>
  
 
To get following link:
 
To get following link:
  
{{Earth_coordinates |x=123 |y=234 |z=345}}
+
{{Coordinates |x=123 |y=234 |z=345}}
 +
 
 +
=== Example with custom zoom ===
 +
 
 +
You can also set zoom level to something other than default 12:
 +
 
 +
<pre>{{Coordinates |zoom=8 |x=123 |y=5234 |z=345}}</pre>
 +
 
 +
To get following link:
 +
 
 +
{{Coordinates |zoom=8 |x=123 |y=5234 |z=345}}
 +
 
 +
== History ==
 +
 
 +
I created this template and moved it to "Earth coordinates". I want it to do two things: be both human-readable and have a map link. - [[User:6r1d]]
 +
 
 +
Updated to handle all layers dynamically based on y coordinate. Not Earth specific anymore and should be used for all coordinates.
  
 
[[Category:Template]]
 
[[Category:Template]]
  
 
<includeonly><onlyinclude><code>[https://pandorabox.io/map/#!/map/{{#ifexpr:{{{y}}} < 5000 | 0 | {{#ifexpr:{{{y}}} < 6000 | 1 | {{#ifexpr:{{{y}}} < 11000 | 2 | 3 }} }} }}/{{{zoom|12}}}/{{{x}}}/{{{z}}} '''X''': {{{x}}} '''Y''': {{{y}}} '''Z''': {{{z}}}]</code></onlyinclude></includeonly>
 
<includeonly><onlyinclude><code>[https://pandorabox.io/map/#!/map/{{#ifexpr:{{{y}}} < 5000 | 0 | {{#ifexpr:{{{y}}} < 6000 | 1 | {{#ifexpr:{{{y}}} < 11000 | 2 | 3 }} }} }}/{{{zoom|12}}}/{{{x}}}/{{{z}}} '''X''': {{{x}}} '''Y''': {{{y}}} '''Z''': {{{z}}}]</code></onlyinclude></includeonly>

Latest revision as of 20:49, 16 January 2021

Description

Use this template to show inline coordinates on the map. I.e. embed them on some sentence with a distinct style, or, alternatively, embed in some other template.

Map layer will be automatically selected based on y parameter:

  • y < 5000 for earth, map layer 0
  • y < 6000 for moon, map layer 1
  • y < 11000 for space, map layer 2
  • y 11000 and above for mars, map layer 3

Example

Use following code:

{{Coordinates |x=123 |y=234 |z=345}}

To get following link:

X: 123 Y: 234 Z: 345

Example with custom zoom

You can also set zoom level to something other than default 12:

{{Coordinates |zoom=8 |x=123 |y=5234 |z=345}}

To get following link:

X: 123 Y: 5234 Z: 345

History

I created this template and moved it to "Earth coordinates". I want it to do two things: be both human-readable and have a map link. - User:6r1d

Updated to handle all layers dynamically based on y coordinate. Not Earth specific anymore and should be used for all coordinates.