Template:Coord/doc/internals
Template:Coord consists of a number of subtemplates. This page provides an explanation of how the template uses these subtemplates.
Index
The following templates are obsolete "subroutines" of {{Coord}}. Separating them out drastically reduced the pre-expand size of {{Coord}}. They should no longer be used at all.
name | function |
---|---|
{{Coord/display/inline}} | displays coordinates inline |
{{Coord/display/inline,title}} | displays coordinates inline and above the article |
{{Coord/display/title}} | displays coordinates above the article (generally to the right of the article's title) |
{{Coord/link}} | generates microformats and link to GeoHack |
{{Coord/input/dec}} | reads coordinates in decimal degrees {{Coord|12|-12}} |
{{Coord/input/d}} | reads coordinates in decimal degrees with directional letters {{Coord|12|N|12|W}} |
{{Coord/input/dm}} | reads coordinates in degrees/minutes format {{Coord|12|12|N|12|12|W}} |
{{Coord/input/dms}} | reads coordinates in degrees/minutes/seconds format {{Coord|12|12|12|N|12|12|12|W}} |
{{Coord/input/ERROR}} | generates error message if the inputs do not match any of the above formats |
{{Coord/input/error2}} | generates error message for range checks and such |
{{Coord/input/nolat}} | generates error message for missing latitude |
{{Coord/negzeropad}} | pads a positive number with trailing zeroes until it matches the precision of a negative number |
{{Coord/prec dec}} | selects a format for converting decimal degrees, based on the precision of the inputs |
Use cases
dec: {{Coord|9|-9|type:landmark}} 1 2 3 d: {{Coord|9|N|9|W|type:landmark}} 1 2 3 4 5 dm: {{Coord|9|9|N|9|9|W|type:landmark}} 1 2 3 4 5 6 7 dms: {{Coord|9|9|9|N|9|9|9|W|type:landmark}} 1 2 3 4 5 6 7 8 9
Coord
Input: Parameters 1, 2, 3, 4, 5, 6, 7, 8, 9, format, name
Pass all parameters to one of the following input templates:
if no 4th parameter
use #Coord/input/dec
else if 4th and 8th together are NE, NW, SE or SW
use #Coord/input/dms
else if 3rd and 6th together are NE, NW, SE or SW
use #Coord/input/dm
else if 2nd and 4th together are NE, NW, SE or SW
use #Coord/input/d
else
use #Coord/input/ERROR
The input templates differ on which parameters they use and what they do to them.
Coord/input/dec
Input: Parameters 1, 2, 3, format, name
Pass to Coord/link the following parameters:
- dms-lat and dms-long: The latitude and longitude in degrees (minutes (and seconds)) format as text (and not separate parameters), using
- Coord/prec dec to determine whether minutes and seconds are needed to cover the precision of the given number of decimal digits, and
- Coord/dec2dms to split them to the necessary parts.
- dec-lat and dec-long: Passed along as given.
- param: URL parameters for use in Template:GeoTemplate
- default: The format parameter, or "dec" if not given. Used in #Coord/link
- name: Passed along as given.
Coord/input/d
Input: Parameters 1, 2, 3, 4, 5, format, name
Pass to Coord/link the following parameters:
- dms-lat and dms-long: The latitude and longitude in degrees (minutes (and seconds)) format as text (and not separate parameters), using
- Coord/prec dec to determine whether minutes and seconds are needed to cover the precision of the given number of decimal digits, and
- Coord/dec2dms to split them to the necessary parts.
- dec-lat and dec-long: Passed along with signs from NSEW using Coord/dms2dec
- param: URL parameters for use in Template:GeoTemplate
- default: The format parameter, or "dec" if not given. Used in #Coord/link
- name: Passed along as given.
Coord/input/dm
...
Coord/input/dms
...
Coord/link
Input: Template:Coor URL and parameters dms-lat, dms-long, dec-lat, dec-long, param, name, default
Creates a link of the given coordinates, displaying the coordinate parameters as such. The default parameter controls which of dms or dec is shown, by using the geo classes in MediaWiki:Common.css, as described in {{UF-coord-classes}}
In addition, "geo" and the nested "latitude" and "longitude" have special meaning as a Geo microformat and so might also be used by other templates.
Coord/display/inline,title
Template:Coord/display/inline,title
...