Geocode 0.6.6

From Mapping on MediaWiki
Jump to: navigation, search
Geocode 0.6.6
Converts addresses to coordinates
Min version:
Max version:
Function implementation:
Tag implementation:

The #geocode parser function enabled 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.



{{#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

This documentation page applies to all (Semantic) Maps versions from 0.1 to 0.6.6.
Other versions: ≥ 0.7      

Geocode en 0.1 0.6.6