Maps examples/Geocode

From semantic-mediawiki.org
Table of Contents

The geocode function or tag allows to transform the position of locations into coordinates, i.e. to determine coordinates.

Specify a mapping service[edit]

Geocoding "New York" with several mapping services:

Default mapping service ("nominatim") :

{{#geocode: location=New York}}

40° 43' 51.10" N, 73° 59' 13.76" W

Using nominatim and specifying it as second parameter:

{{#geocode: location=New York |service=nominatim }}

40° 43' 51.10" N, 73° 59' 13.76" W

Using geonames:

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

40° 43' 51.10" N, 73° 59' 13.76" W

Using google and specifying it as named parameter:

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

40° 43' 51.10" N, 73° 59' 13.76" W

An API key is required since June 2018 to make it work with Google. See this help page for further information.

Specify a target format[edit]

Formatting to non-directional floats and to directional DMS.

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

Results into: 40.730861111111, -73.987155555556

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

Results into: 40° 43' 51.10" N, 73° 59' 13.76" W


Passing along coordinates

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

Results into: 40.714166666667, -75.993888888889

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

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


See also[edit]