Maps/Geodistance

From semantic-mediawiki.org
< Maps(Redirected from Extension:Maps/Geodistance)
Extension "Maps"Maps/Geodistance
Maps extension
Overview
Installation and Configuration
Usage
Displaying maps
Customizing maps
Displaying GeoJSON
Geocoding
Converting coordinates
SMW integration
Storing coordinates
Aggregating onto a map
On this page


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[edit]

{{#geodistance:
 <first location>
 |<second location>
 |unit=<optional unit>
 |decimals=<optional number>
}}

Parameters[edit]

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[edit]

Basic syntax[edit]

{{#geodistance:Brussels|Berlin}}

Result: 649,652.98 m

Specifying the unit and decimals[edit]

{{#geodistance:Brussels|Berlin|unit=km|decimals=0}}

Result: 650 km

Using coordinates[edit]

{{#geodistance:52.5200° N, 13.4050° E|40.7128° N, 74.0060° W|unit=km}}

Result: 6,385 km