Skip to content
Geocoding API

Geocoding API

The Geocoding API converts between addresses and coordinates. Use forward geocoding to get coordinates for a search term, or reverse geocoding to get an address from a location.

Data comes from OpenStreetMap and additional regional sources.

Base URL

https://geocoder.maptoolkit.net

Authentication

Add your API key as ?api_key=YOUR_API_KEY to every request. See Authentication for details.

Forward Geocoding

Search for an address or place name and get back coordinates.

Endpoint:

GET https://geocoder.maptoolkit.net/search

Parameters:

ParameterTypeRequiredDescription
qstringYesThe address or place name to search for.
countrycodesstringNoLimit results to specific countries. Use ISO 3166-1 alpha-2 codes, comma-separated (e.g., de,at).
viewboxminLng,minLat,maxLng,maxLatNoPreferred area for results.
languagestringNoLanguage for result names. Default: de.
limitnumberNoMaximum number of results. Default: 10.
polygon0 or 1NoInclude polygon outlines in results. Default: 0.
callbackstringNoWrap the response in a JSONP callback.

Search terms are matched left-to-right first, then right-to-left if that fails. Commas are optional but improve performance: pilkington avenue, birmingham works better than birmingham pilkington avenue.

Example:

GET https://geocoder.maptoolkit.net/search?q=Kirchengasse%2C%20Wien&language=en&api_key=YOUR_API_KEY

Response:

[
  {
    "display_name": "Kirchengasse, Neubau, Wien, 1070, Österreich",
    "lat": "48.2006928",
    "lon": "16.3522368",
    "boundingbox": ["48.1994", "48.2020", "16.3510", "16.3535"],
    "place_id": "23708113",
    "osm_type": "way",
    "osm_id": "12345678"
  }
]

Reverse Geocoding

Get an address from a latitude and longitude.

Endpoint:

GET https://geocoder.maptoolkit.net/reverse

Parameters:

ParameterTypeRequiredDescription
latnumberYesLatitude of the location.
lonnumberYesLongitude of the location.
languagestringNoLanguage for the result. Default: de.
polygon0 or 1NoInclude polygon outline in result. Default: 0.
callbackstringNoWrap the response in a JSONP callback.

Example:

GET https://geocoder.maptoolkit.net/reverse?lat=48.2007&lon=16.3522&language=en&api_key=YOUR_API_KEY

Response:

{
  "display_name": "Kirchengasse 9, Neubau, Wien, 1070, Österreich",
  "lat": "48.2006928",
  "lon": "16.3522368",
  "place_id": "23708113",
  "osm_type": "node",
  "osm_id": "3016786133",
  "address": {
    "road": "Kirchengasse",
    "house_number": "9",
    "suburb": "Neubau",
    "city": "Wien",
    "state": "Wien",
    "postcode": "1070",
    "country": "Österreich",
    "country_code": "at"
  }
}