From semantic-mediawiki.org
Jump to: navigation, search

Since people work with addresses instead of coordinates, geocoding functionality is included in Maps. This means Maps will convert a human readable address to a set of coordinates. This functionality is based on the Google Geocoder extension, which, if installed, you will need to un-install before using Maps.

This documentation applies for Maps version 0.6 and later. See this page for pre 0.6 docs.

Supported services

The 'Geoservice param value' is the value you need to pass along with any geoservice parameter.

For more info on the geocoding services, see the Maps/geocoding services page.

Geocode function

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


Parameter Aliases Default Usage
location - required The address you want to geocode.
service - configurable The geocoding service you want to use. See the available Maps/geocoding services.
mappingservice - empty This parameter allows you to indicate you are using this geocoding request in combination with a specific Maps/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.


Geocoding "New York" with several mapping services

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

All result into: 40° 42' 45.99" N, 74° 0' 21.50" W

Formatting to non-directional floats and to directional DMS.

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

Results into: Geocoding failed

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

Results into: Geocoding failed

Passing along coordinates

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

Results into: 40.714166666667, -75.993888888889

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

Results into: 40° 42' 51.37" N, 74° 0' 21.50" W

See also

Pages in the geocoding category: