Geodistance

From Mapping on MediaWiki

Jump to: navigation, search

You can use the #geodistance parser function to calculate the geographical distance between two points, from and to any of the supported formats.

Contents

[edit] Compatibility

This function is part of the Maps extension, so you should have Maps installed in order to use it. This parser function was added in Maps 0.6, and has undergone backwards compatible parameter changes in 0.6.2.

[edit] Usage

[edit] Syntax

{{#coordinates:{starting location}|{ending location}}

[edit] Parameters

This parser function supports use of so called 'default parameters'. This allows you to simply pass along values, without writing the parameter name= part. You can mix this notation together with using named parameters, but must at all times keep the default ones in the correct order. The order is location, location, unit.

Parameter Aliases Default Usage Notes
location1 - required The first point in the set to calculate the distance between.
location2 - required The second point in the set to calculate the distance between.
unit - configurable The unit the output the distance in. Configurable since 0.6.2. Defaulted to 'km' in earlier versions.
decimals - configurable The maximum amount of fractional digits to use in the resulting value. Added in 0.6.2

Both locations can be either a set of coordinates or an address that will then be geocoded.

[edit] Examples

Calculating the distance between two points

{{#geodistance:55.7557860° N, 37.6176330° W|-42.42, 42.42}}

Results into: 13239091.81 m

{{#geodistance:New York|Los Angeles}}

Results into: 3935735.23 m

Personal tools
Namespaces
Variants
Actions
Navigation
manuals
services
extensions
data
Toolbox