From Mapping on MediaWiki
Jump to: navigation, search

User manual




Displaying maps

Displaying markers

Customizing markers

Mapping services

Semantic mapping

Coordinates data-type

Querying coordinate data

Distance query

Maps in forms

Admin manual

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.

Geocoding service Geoservice param value Description Licence Max requests
GeoNames geonames Free geocoding service with over 8 million objects Creative Commons attribution unknown
Google (geocoding) google Geocoding service provided by Google that can only be used for displaying Google Maps maps A Google licence 50,000 per day
Yahoo! (geocoding) yahoo Geocoding service provided by Yahoo! A Yahoo! licence 50,000 per day

For more info on the geocoding services, see the Geocoding services page.

Geocode function


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


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.


Geocoding "New York" with several mapping services

{{#geocode:New York}}
{{#geocode:New York|geonames}}
{{#geocode:New York|service=google}}
All result into:
Fatal error: Parameter location must be a valid location.

Formatting to non-directional floats and to directional DMS.

{{#geocode:location=New York City|format=float|directional=no}}
Results into:
Fatal error: Parameter location must be a valid location.

{{#geocode:New York City|format=dms|directional=yes}}
Results into:
Fatal error: Parameter location must be a valid location.

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

Pages in the geocoding category:

This documentation page applies to all (Semantic) Maps versions from 0.1 to the most current version.

Help:Geocoding en 0.1