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.netAuthentication
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/searchParameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | The address or place name to search for. |
countrycodes | string | No | Limit results to specific countries. Use ISO 3166-1 alpha-2 codes, comma-separated (e.g., de,at). |
viewbox | minLng,minLat,maxLng,maxLat | No | Preferred area for results. |
language | string | No | Language for result names. Default: de. |
limit | number | No | Maximum number of results. Default: 10. |
polygon | 0 or 1 | No | Include polygon outlines in results. Default: 0. |
callback | string | No | Wrap 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_KEYResponse:
[
{
"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/reverseParameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
lat | number | Yes | Latitude of the location. |
lon | number | Yes | Longitude of the location. |
language | string | No | Language for the result. Default: de. |
polygon | 0 or 1 | No | Include polygon outline in result. Default: 0. |
callback | string | No | Wrap 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_KEYResponse:
{
"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"
}
}