Geodistance function
From Maps for MediaWiki
Maps can calculate the distance between two locations. This is done via the #geodistance parser function, which has a similar format to, and should not be confused with, the #distance parser function
Syntax
{{#geodistance:
<first location>
|<second location>
|unit=<optional unit>
|decimals=<optional number>
}}
Parameters
| Parameter | Default | Description |
|---|---|---|
| location1 | required | Address or coordinates of the first location |
| location2 | required | Address or coordinates of the second location |
| 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
{{#geodistance:Brussels|Berlin}}
Result: 650,075.22 m
Specifying the unit and decimals
{{#geodistance:Brussels|Berlin|unit=km|decimals=0}}
Result: 650 km
Using coordinates
{{#geodistance:52.5200° N, 13.4050° E|40.7128° N, 74.0060° W|unit=km}}
Result: 6,385 km