Geodistance 0.6.6
Geodistance 0.6.6 |
---|
What: |
Calculates the distance between two points |
Min version: |
0.6 |
Max version: |
Function implementation: |
Yes |
Tag implementation: |
No |
You can use the #geodistance parser function to calculate the geographical distance between two points, from and to any of the supported formats.
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.
Usage
Syntax
{{#geodistance:{starting location}|{ending location}}
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 | from | required | The first point in the set to calculate the distance between. | Alias since 0.7 |
location2 | to | required | The second point in the set to calculate the distance between. | Alias since 0.7 |
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 |
geoservice | - | configurable | The geocoding service to use to geocode any addresses. | Added in 0.7 |
mappingservice | - | configurable | The mapping service this is used together with. This can affect the default geocoding service value. | Added in 0.7 |
Both locations can be either a set of coordinates or an address that will then be geocoded.
Examples
Calculating the distance between two points
{{#geodistance:55.7557860° N, 37.6176330° W|-42.42, 42.42}}
Results into: 13,239,091.81 m
{{#geodistance:New York|Los Angeles|unit=km}}Results into:
<geodistance from="New York City" to="Los Angeles" unit="miles" geoservice="geonames" />Results into:
See also
- Distance parser hook
- Finddestination parser hook
From version | 0.6 + |
Has description | Calculates the distance between two points + |
Has minimum version | 0.6 + |
Has parser function | true + |
Has tag extension | false + |
Is master page | false + |
Language code | en + |
Master page | Geodistance + |
To version | 0.6.6 + |