From Wikipedia, the free encyclopedia
Jump to: navigation, search

The GeoTemplate can be invoked by using {{Coord}}. An external tool fills the template with the coordinates data as described on this page.


GeoHack (the tool that fills GeoTemplate with working links) takes two inputs:

  • URL parameters: Coordinates are given in one of the following formats: D_M_S_N_D_M_S_E, D_M_N_D_M_E, D_N_D_E, or D;D where D is degrees, M is minutes, S is seconds, and NS/EW are the directions. They can be followed by coordinate parameters such as type, scale and region, separated by underscores. On Wikipedia the URL is generated by coordinate templates.
    For example, the wikitext {{coord|51|28|40|N|0|0|6|W|type:landmark_scale:2000_region:GB}} becomes params=51_28_40_N_0_0_6_W_type:landmark_scale:2000_region:GB in the URL.
  • The template page (contents of GeoTemplate) where variables are replaced with values computed from the data given in the URL. The rest of this page documents the available variables.


GeoHack provides the following variables based on the given coordinates (51_28_40_N_0_0_6_W in the example above).

  • Latitude/longitude
    • {latdegabs}, {londegabs}WGS84 Absolute integer degrees
    • {latdegdec}, {londegdec}, {londegneg}WGS84 Total decimal degrees
    • {latdegdecabs}, {londegdecabs}, {londegneg}WGS84 Absolute decimal degrees
    • {latdegint}, {londegint}WGS84 Floored integer degrees
    • {latdeground}, {londeground}WGS84 Rounded integer degrees
    • {latmindec}, {lonmindec}WGS84 Decimal minutes
    • {latminint}, {lonminint}WGS84 Integer minutes
    • {latNS}, {lonEW}WGS84 Direction of absolute integer degrees
    • {latsecdec}, {lonsecdec}WGS84 Decimal seconds
    • {latsecint}, {lonsecint}WGS84 Integer seconds
    • {latantipodes}, {longantipodes} – Antipodes of {latdegdec}, {londegdec}
  • UTM
    • {utmnorthing} {utmeasting} {utmzone}UTM coordinate
    • {utm33northing}, {utm33easting} – Northing and easting for special cases
  • National grids
    • {ch1903easting}, {ch1903northing}CH1903+ coordinate
    • {osgb36ref}Ordnance Survey Grid reference
    • {osgb36northing}, {osgb36easting} – Special cases
    • {nztmeasting}, {nztmnorthing} – New Zealand Transverse Mercator coordinate (not active?)

Other national grids supported through specific tools: Finland (tools:~para/kkj.php), Tokyo datum (tools:~para/cgi-bin/wgs2tky)


GeoHack accepts a scale parameter (scale:2000 in the example above) which it uses to provide scaling or zoom values for different mapping services.

Name Used by Formula
{scale} Virtual Globe supplied in URL via scale or calculated based on type
{mmscale} Multimap closest scale value accepted by Multimap (see mapsources.php)
{span} Google Maps, WikiMapia scale / 1000000
{altitude} MSN Maps, Fourmilab, Swissinfo integer( scale * 143 / 1000000)
{zoom} MapQuest, Gule Sider integer(18.0 - log(scale))
{osmzoom} OpenStreetMap, Live Search Maps 18 - ( round(log( scale ,2) - log(1693,2)) )

GeoHack accepts a type parameter (type:landmark in the example above) from which it will calculate a scale value when none is supplied. The following chart shows the types currently understood by GeoHack, the scale ratio associated with each, plus the additional variables calculated by GeoHack.

{type} Ratio {scale} {mmscale} {span} {altitude} {zoom} {osmzoom}
country 1 : 10,000,000 10000000 10000000 10.0 1430 1 5
state 1 : 3,000,000 3000000 4000000 3.0 429 3 7
adm1st 1 : 1,000,000 1000000 1000000 1.0 143 4 9
adm2nd (default) 1 : 300,000 300000 200000 0.3 42 5 11
city, mountain, isle,
river, waterbody
1 : 100,000 100000 100000 0.1 14 6 12
forest, glacier 1 : 50,000 50000 50000 0.05 7 7 13
airport 1 : 30,000 30000 25000 0.03 4 7 14
edu, pass, landmark, railwaystation 1 : 10,000 10000 10000 0.01 1 8 15

The default values can for each type can be overridden by also supplying a scale. For example, type:airport is assigned a {scale} of 30000, while type:airport_scale:10000 uses the supplied {scale} of 10000.

For detailed implementation see mapsources.php


  • {region}, {globe}, {page} – Look up page from Wikipedia. See if we have something in Wikipedia:Map sources or equivalent. A subpage can be specified
  • {pagename} – The value from the pagename key in the query (e.g. &pagename=Article) (URI scheme#Generic syntax) – FULLPAGENAMEE expected. When used with {{Coord}} this returns the containing article name with whitespace replaced by underscores. For example: Bellevue Botanical Garden becomes Bellevue_Botanical_Garden.
  • {title} – The value from the title key in the query (e.g. &title=Name). If not given in the query, is the same as {pagename}. //

Section coding[edit]

When the parameters contain a region or GeoHack finds the region with the coordinates, a matching section is moved to the location marked with the placeholder:

<div id="GEOTEMPLATE-LOCAL"></div>

The region sections are wrapped in an element where the XX of the id is the ISO 3166-1 alpha-2 code: