Extension "Maps"Maps/Geocode

The Maps extension supports geocoding at all places where you can specify a location. You can access this functionality directly using the #geocode parser function, which gives you the coordinates for the address you provide to it.


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


You can use #geocode inline with some text or in an infobox.

The Brandenburg Gate is in Berlin at {{#geocode:Brandenburg Gate}}

Result: The Brandenburg Gate is in Berlin at 52° 30' 58.60" N, 13° 22' 39.73" E

Another common use case is to store coordinates in SMW using the coordinate data type, so they can be queried.

[[Has coordinates::{{#geocode: Brandenburg Gate}}]]


Parameter Default Usage
location required The address you want to geocode.
format dms (changeable in wiki config with egMapsCoordinateNotation) The format to convert the coordinates to. See available coordinate formats
directional yes (changeable in wiki config with egMapsCoordinateDirectional) Indicates if the coordinates should be outputted directional or not. Must be either yes or no.


Basic syntax

{{#geocode:New York}}

Result: 40° 43' 50.32" N, 73° 59' 11.81" W

Specifying the output coordinate format

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

Result: 40.730644444444, -73.986613888889

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

Result: 40° 43' 50.32" N, 73° 59' 11.81" W

Passing along coordinates

This is to show that if you have a dynamic value that can be either an address or a set of coordinates, you can safely pass it to the #geocode parser function. If you want to convert coordinates into a different format, it is better to use the #coordinates parser function.

{{#geocode:40.7142691, -74.0059729}}

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