Distance function

From Maps for MediaWiki

Just like maps can parse and display coordinates in multiple formats, it can parse and display distances. You can convert between different distance formats using the #distance parser function.

Syntax[edit | edit source]

{{#distance:distance|unit=<optional unit>|decimals=<optional number>}}

Parameters[edit | edit source]

Parameter Default Usage
distance required The distance to convert
unit m (changeable in wiki config with egMapsDistanceUnit) The unit to display the distance in. Supported units can be found and changed in the wiki config with egMapsDistanceUnits
decimals 2 (changeable in wiki config with egMapsDistanceDecimals) The amount of decimals to show the distance in. Must be a positive integer

Examples[edit | edit source]

Basic syntax[edit | edit source]

{{#distance:42km}}

Result: 42,000 m

Miles to kilometers[edit | edit source]

{{#distance:42km|unit=miles|decimals=1}}

Result: 26.1 miles