Coordinates function

From Maps for MediaWiki
Revision as of 22:02, 7 May 2020 by Jeroen De Dauw (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Maps provides the #coordinates parser function which allows conversion between all supported coordinate formats.

Syntax[edit | edit source]

{{#coordinates: <coordinates> |format=<coordinate format> |directional=<yes/no> }}

Parameters[edit | edit source]

Parameter Default Description
location required The coordinates you want to convert in any of the supported formats
format dms (changeable in wiki config with egMapsCoordinateNotation) The format to convert the coordinates to (available formats can be restricted in the wiki config with egMapsAvailableCoordNotations)
directional yes (changeable in wiki config with egMapsCoordinateDirectional) Indicates if the coordinates should be outputted directional or not. Must be either yes or no.

Examples[edit | edit source]

Coordinates in directional decimal degrees to the default target format.

{{#coordinates:55.7557860° N, 37.6176330° W}}
{{#coordinates:location=55.7557860° N, 37.6176330° W}}

All result into: 55° 45' 20.83" N, 37° 37' 3.48" W

Coordinates in non-directional floats to directional DMS.

{{#coordinates:55.7557860, -37.6176330|format=dms|directional=yes}}
{{#coordinates:55.7557860, -37.6176330|dms|yes}}
{{#coordinates:55.7557860, -37.6176330|directional=yes|dms}}

All result into: 55° 45' 20.83" N, 37° 37' 3.48" W

Use of the coordinates tag extension.

<coordinates format="dms">55.7557860, -37.6176330</coordinates>

Results into: 55° 45' 20.83" N, 37° 37' 3.48" W

<coordinates format="dd" directional="no">55.7557860, -37.6176330</coordinates>

Results into: 55.755786°, -37.617633°

Configuration[edit | edit source]

This parser function #coordinates can be disabled as of Maps 7.1 with $egMapsEnableCoordinateFunction = false;. This helps in the case Template:Extend is installed together with Template:Extend since they share the same parser function called #coordinates. The default value for this parameter is true.

See also[edit | edit source]

  • Coordinate formats – The coordinate formats that Maps supports
  • Geodistance – A parser function for finding the distance between two locations
  • Distance – A parser function for converting distances