Geocoding API
On-prem geocoding makes it possible to add place search to your self-hosted maps. It includes both forward geocoding (search by place name) and reverse geocoding (search by coordinates).
Geocoding API reference
Geocoding
Search by name (forward)
Forward geocoding (search by place name).
- Type: stringqueryrequired
Place name to search. You can also use bare POI category or mix it with a name to search for POIs of desired category, unless
poiindex is excluded.
- Type: array · bboxbbox
A
[w, s, e, n]bounding box array to use for limiting search results. Only features inside the provided bounding box will be included. - proximity
A
[lon, lat]array to use for biasing search results or the stringipto do server-side IP based geolocation. Specify to prefer results close to a specific location - features closer to the proximity value will be given priority over those further from the proximity value.- Type: array · Coordinates
- Type: array string[] …20 unique!enumlanguage
Prefer results in specific language specified as ISO 639-1 code. Only the first language code is used when prioritizing forward geocode results to be matched. If this query parameter is omited then Accept-Language HTTP header will be analyzed. If the parameter is provided but is empty then no language preference is made.
values- aa
- ab
- ae
- af
- ak
- Type: array string[] unique!country
Limit search to specific country/countries.
- Type: integerlimitmin:1max:10
Maximum number of results. Default: 5 for forward geocoding, 1 for reverse geocoding. For reverse geocoding, limit > 1 requires exactly one
typesvalue and switches to a nearest-neighbour search (N closest features of that type within 1 km). Without limit, reverse geocoding returns a single best match per layer at the queried point - Type: array string[] · PlaceType[] unique!enumtypes
Filter types of which features to return. If not specified, default configuration of API is used (see PlaceTypeValues for the list). In case of reverse geocoding if just a single type is specified, then multiple nearby features of the single
typecan be returned, otherwise single feature for every specified type (or default types) can be returned - see also the limit parameter.- Type: string · PlaceTypeenum
Check out the descriptions and default values of each of the PlaceType values
values- continental
_marine - country
- major
_landform - region
- subregion
- Type: booleanexclude
Types Set to
trueto use all available feature types except those specified intypes. - Type: booleanfuzzy
Match Set to
falseto disable fuzzy search. - Type: booleanautocomplete
Set to
trueto use autocomplete,falseto disable autocomplete. - Type: string enumworldview
Some of the geographical boundaries and names are disputed. When
worldviewoption is selected, the Geocoding API responses will be aligned with the borders and names recognized by the selected country (e.g., US or Switzerland). This affects filtering by country, the context returned with the given feature and also some of the labels (e.g., Gulf of Mexico vs. Gulf of America). Special values include:auto- the worldview is determined by the location of the client,default- disputed areas are returned without country information, countries with disputed borders are returned without full geometry.values- default
- auto
- ae
- ch
- jp
- kr
- us
- application/json
- 400
Query too long / Invalid parameters
curl http://localhost:3650/api/geocoding/Zurich.json
{
"type": "FeatureCollection",
"features": [
{
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string",
"additionalProperty": "anything",
"type": "Feature",
"properties": {
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything"
},
"geometry": {
"type": "Point",
"coordinates": [
8.528509,
47.3774434
]
},
"bbox": [
5.9559,
45.818,
10.4921,
47.8084
],
"center": [
8.528509,
47.3774434
],
"place_name": "string",
"matching_place_name": "string",
"matching_text": "string",
"place_type": [
"continental_marine"
],
"place_type_name": [
"string"
],
"relevance": 1,
"context": [
{
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything",
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string"
}
],
"address": "string",
"^place_name_(\\w\\w)": "string"
}
],
"query": [
"string"
],
"attribution": "<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">© MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">© OpenStreetMap contributors</a>"
}Search result represented as FeatureCollection where every item is represented as a GeoJSON Feature
Search by coordinates (reverse)
Reverse geocoding (search by coordinates).
- Type: numberlongitudemin:-180max:180required
- Type: numberlatitudemin:-90max:90required
- Type: array string[] …20 unique!enumlanguage
Prefer results in specific language specified as ISO 639-1 code. Only the first language code is used when prioritizing forward geocode results to be matched. If this query parameter is omited then Accept-Language HTTP header will be analyzed. If the parameter is provided but is empty then no language preference is made.
values- aa
- ab
- ae
- af
- ak
- Type: integerlimitmin:1max:10
Maximum number of results. Default: 5 for forward geocoding, 1 for reverse geocoding. For reverse geocoding, limit > 1 requires exactly one
typesvalue and switches to a nearest-neighbour search (N closest features of that type within 1 km). Without limit, reverse geocoding returns a single best match per layer at the queried point - Type: array string[] · PlaceType[] unique!enumtypes
Filter types of which features to return. If not specified, default configuration of API is used (see PlaceTypeValues for the list). In case of reverse geocoding if just a single type is specified, then multiple nearby features of the single
typecan be returned, otherwise single feature for every specified type (or default types) can be returned - see also the limit parameter.- Type: string · PlaceTypeenum
Check out the descriptions and default values of each of the PlaceType values
values- continental
_marine - country
- major
_landform - region
- subregion
- Type: booleanexclude
Types Set to
trueto use all available feature types except those specified intypes. - Type: string enumworldview
Some of the geographical boundaries and names are disputed. When
worldviewoption is selected, the Geocoding API responses will be aligned with the borders and names recognized by the selected country (e.g., US or Switzerland). This affects filtering by country, the context returned with the given feature and also some of the labels (e.g., Gulf of Mexico vs. Gulf of America). Special values include:auto- the worldview is determined by the location of the client,default- disputed areas are returned without country information, countries with disputed borders are returned without full geometry.values- default
- auto
- ae
- ch
- jp
- kr
- us
- application/json
- 400
Query too long / Invalid parameters
curl http://localhost:3650/api/geocoding/8.528509,47.3774434.json
{
"type": "FeatureCollection",
"features": [
{
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string",
"additionalProperty": "anything",
"type": "Feature",
"properties": {
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything"
},
"geometry": {
"type": "Point",
"coordinates": [
8.528509,
47.3774434
]
},
"bbox": [
5.9559,
45.818,
10.4921,
47.8084
],
"center": [
8.528509,
47.3774434
],
"place_name": "string",
"matching_place_name": "string",
"matching_text": "string",
"place_type": [
"continental_marine"
],
"place_type_name": [
"string"
],
"relevance": 1,
"context": [
{
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything",
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string"
}
],
"address": "string",
"^place_name_(\\w\\w)": "string"
}
],
"query": [
"string"
],
"attribution": "<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">© MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">© OpenStreetMap contributors</a>"
}Search result represented as FeatureCollection where every item is represented as a GeoJSON Feature
Search by feature ID
Search feature by its ID (id) as returned in forward or reverse geocoding response and return its full geometry. Note that the feature ID is not stable and it changes when the database is re-indexed.
- Type: stringidrequired
Feature ID (found in response of forward or reverse geocoding)
- Type: array string[] …20 unique!enumlanguage
Prefer results in specific language specified as ISO 639-1 code. Only the first language code is used when prioritizing forward geocode results to be matched. If this query parameter is omited then Accept-Language HTTP header will be analyzed. If the parameter is provided but is empty then no language preference is made.
values- aa
- ab
- ae
- af
- ak
- Type: string enumworldview
Some of the geographical boundaries and names are disputed. When
worldviewoption is selected, the Geocoding API responses will be aligned with the borders and names recognized by the selected country (e.g., US or Switzerland). This affects filtering by country, the context returned with the given feature and also some of the labels (e.g., Gulf of Mexico vs. Gulf of America). Special values include:auto- the worldview is determined by the location of the client,default- disputed areas are returned without country information, countries with disputed borders are returned without full geometry.values- default
- auto
- ae
- ch
- jp
- kr
- us
- application/json
- 400
Query too long / Invalid parameters
curl http://localhost:3650/api/geocoding/country.26561650.json
{
"type": "FeatureCollection",
"features": [
{
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string",
"additionalProperty": "anything",
"type": "Feature",
"properties": {
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything"
},
"geometry": {
"type": "Point",
"coordinates": [
8.528509,
47.3774434
]
},
"bbox": [
5.9559,
45.818,
10.4921,
47.8084
],
"center": [
8.528509,
47.3774434
],
"place_name": "string",
"matching_place_name": "string",
"matching_text": "string",
"place_type": [
"continental_marine"
],
"place_type_name": [
"string"
],
"relevance": 1,
"context": [
{
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything",
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string"
}
],
"address": "string",
"^place_name_(\\w\\w)": "string"
}
],
"query": [
"string"
],
"attribution": "<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">© MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">© OpenStreetMap contributors</a>"
}Search result represented as FeatureCollection where every item is represented as a GeoJSON Feature
Batch geocoding API
Perform geocoding of more than one request in a single API call. Check out the Batch Geocoding guide for an example.
- Type: stringqueriesrequired
Semicolon-separated list of queries. Semicolon
;must be provided verbatim and not be URL-encoded. Each query may be forward, reverse or by feature ID. Maximum of 50 queries are supported.
- Type: array · bboxbbox
A
[w, s, e, n]bounding box array to use for limiting search results. Only features inside the provided bounding box will be included. - proximity
A
[lon, lat]array to use for biasing search results or the stringipto do server-side IP based geolocation. Specify to prefer results close to a specific location - features closer to the proximity value will be given priority over those further from the proximity value.- Type: array · Coordinates
- Type: array string[] …20 unique!enumlanguage
Prefer results in specific language specified as ISO 639-1 code. Only the first language code is used when prioritizing forward geocode results to be matched. If this query parameter is omited then Accept-Language HTTP header will be analyzed. If the parameter is provided but is empty then no language preference is made.
values- aa
- ab
- ae
- af
- ak
- Type: array string[] unique!country
Limit search to specific country/countries.
- Type: integerlimitmin:1max:10
Maximum number of results. Default: 5 for forward geocoding, 1 for reverse geocoding. For reverse geocoding, limit > 1 requires exactly one
typesvalue and switches to a nearest-neighbour search (N closest features of that type within 1 km). Without limit, reverse geocoding returns a single best match per layer at the queried point - Type: array string[] · PlaceType[] unique!enumtypes
Filter types of which features to return. If not specified, default configuration of API is used (see PlaceTypeValues for the list). In case of reverse geocoding if just a single type is specified, then multiple nearby features of the single
typecan be returned, otherwise single feature for every specified type (or default types) can be returned - see also the limit parameter.- Type: string · PlaceTypeenum
Check out the descriptions and default values of each of the PlaceType values
values- continental
_marine - country
- major
_landform - region
- subregion
- Type: booleanexclude
Types Set to
trueto use all available feature types except those specified intypes. - Type: booleanfuzzy
Match Set to
falseto disable fuzzy search. - Type: booleanautocomplete
Set to
trueto use autocomplete,falseto disable autocomplete. - Type: string enumworldview
Some of the geographical boundaries and names are disputed. When
worldviewoption is selected, the Geocoding API responses will be aligned with the borders and names recognized by the selected country (e.g., US or Switzerland). This affects filtering by country, the context returned with the given feature and also some of the labels (e.g., Gulf of Mexico vs. Gulf of America). Special values include:auto- the worldview is determined by the location of the client,default- disputed areas are returned without country information, countries with disputed borders are returned without full geometry.values- default
- auto
- ae
- ch
- jp
- kr
- us
- application/json
- 400
Query too long / Invalid parameters
curl 'http://localhost:3650/api/geocoding/Paris;Berlin.json'
[
{
"type": "FeatureCollection",
"features": [
{
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string",
"additionalProperty": "anything",
"type": "Feature",
"properties": {
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything"
},
"geometry": {
"type": "Point",
"coordinates": [
8.528509,
47.3774434
]
},
"bbox": [
5.9559,
45.818,
10.4921,
47.8084
],
"center": [
8.528509,
47.3774434
],
"place_name": "string",
"matching_place_name": "string",
"matching_text": "string",
"place_type": [
"continental_marine"
],
"place_type_name": [
"string"
],
"relevance": 1,
"context": [
{
"ref": "osm:r71525",
"country_code": "fr",
"kind": "road",
"categories": [
"restaurant"
],
"feature_tags": {
"additionalProperty": "string"
},
"place_designation": "city",
"additionalProperty": "anything",
"id": "municipality.46425",
"text": "Paris",
"language": "en",
"^text_(\\w\\w)": "string",
"^language_(\\w\\w)": "string"
}
],
"address": "string",
"^place_name_(\\w\\w)": "string"
}
],
"query": [
"string"
],
"attribution": "<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">© MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">© OpenStreetMap contributors</a>"
}
]Array of geocoding results where items are matching order of queries in the request. Every result is represented as FeatureCollection where every item is represented as a GeoJSON Feature