Coordinates function: Difference between revisions

From Maps for MediaWiki
(Created page with "Maps provides the <code>#coordinates</code> parser function which allows conversion between all supported coordinate formats. ==Syntax== <pre> {...")
 
No edit summary
 
Line 1: Line 1:
Maps provides the <code>#coordinates</code> parser function which allows conversion between all [[Maps/Coordinate_formats|supported coordinate formats.]]  
Maps provides the <code>#coordinates</code> parser function which allows conversion between all [[Coordinate formats|supported coordinate formats.]]  


==Syntax==
==Syntax==

Latest revision as of 22:02, 7 May 2020

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

Syntax

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

Parameters

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

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

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

  • 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