Distance function

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

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

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

Parameters

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

Basic syntax

{{#distance:42km}}

Result: 42,000 m

Miles to kilometers

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

Result: 26.1 miles