Geocode

From Mapping on MediaWiki
Jump to: navigation, search
Geocode
What:
Converts addresses to coordinates
Min version:
0.1
Max version:
still supported
Function implementation:
Yes
Tag implementation:
Yes


The #geocode parser function enables the geocoding of addresses, in other words, turning human readable locations into sets of coordinates. There is support for several geocoding services, which should not be confused with mapping services. This function is part of the Maps extension, so you should have Maps installed in order to use it.

Usage

Syntax

{{#geocode:{your address}|{geocoding service}|{mapping service}|format={your format}|directional={yes/no}}}

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. This order is location, service and mappingservice.

Parameter Aliases Default Usage
location - required The address you want to geocode.
service - configurable The geocoding service you want to use. See the available geocoding services.
mappingservice - empty This parameter allows you to indicate you are using this geocoding request in combination with a specific mapping service. Each mapping service can have overrides over the default value for the geocoding service. This is for legal considerations, since you can not use the Google Geocoding service except together with Google Maps. Settings this parameter and not the service one will ensure you are not using an invalid combination.
format notation configurable The format for the resulting coordinates.
directional - configurable Indicates if the coordinates should be outputted directional or not. Must be either yes or no.
allowcoordinates - configurable Allows disabling the support for coordinates in this function. Must be either yes or no. When no, every value will be geocoded, even valid coordinates.

Examples

Geocoding "New York" with several mapping services

{{#geocode:New York}}
{{#geocode:New York|geonames}}
{{#geocode:New York|service=google}}

All result into: 40° 42' 46" N, 74° 0' 21" W

Formatting to non-directional floats and to directional DMS.

{{#geocode:location=New York City|format=float|directional=no}}

Results into: 40.7127837, -74.0059413

{{#geocode:New York City|format=dms|directional=yes}}

Results into: 40° 42' 46" N, 74° 0' 21" W

Passing along coordinates

{{#geocode:40° 42' 51", -75° 59' 38"|yahoo|format=float|directional=no}}

Results into: 40.7141666667, -75.9938888889The following error has been detected in your syntax:
* The value "yahoo" is not valid for parameter geoservice. It only accepts these values: geonames and google.

{{#geocode:40.7142691, -74.0059729|format=dms|directional=yes}}

Results into: 40° 42' 51" N, 74° 0' 22" W

See also

This documentation page applies to all (Semantic) Maps versions from 0.7 to the most current version.
Other versions: 0.1 – 0.6.6      

Geocode en 0.7