Advanced geocoding parameters

There are more advanced parameters of the Geocoding API, giving developers greater control and power in their geocoding searches. These parameters include:

  • country limits searches to a specific country. One or more countries specified as comma-separated values ISO 3166 alpha 2 country codes.
  • types filter results to include only a subset (one or more) of the available feature types. See the type hierarchy below for allowed values. Multiple options can be comma-separated.
  • autocomplete specify whether to return autocomplete results (true) or not (false). When autocomplete is enabled, results will be included that start with the requested string, rather than just responses that match it exactly. For example, the query “India” might return both “India” and “Indiana” with autocomplete enabled, but only “India” if it’s disabled. The default is to combine exact results autocomplete. When autocomplete is enabled, each user keystroke counts as one request to the Geocoding API. For example, a search for “coff” would be reflected as four separate geocoding API requests. To reduce the total requests sent, you can configure your application to only call the Geocoding API after a specific number of characters are typed.
  • fuzzyMatch specifies whether the Geocoding API should attempt approximate, as well as exact matching when performing searches (true, default), or whether it should opt out of this behavior and only attempt exact matching (false). For example, the default setting might return “Washington, DC” for a query of “wahsington”, even though the query was misspelled.
  • limit controls the maximum number of results to return. The default is 5 and the max support is 10.

Practical usage

  • country: You may want to search for places exclusively in Norway. This way you can effectively exclude Oslo - the capital of Norway, from other Oslo - located in Minnesota, USA.
  • autocomplete and fuzzyMatch: Setting parameters autocomplete and fuzzyMatch to false will ensure that the result will contain only results exactly matching your query without trying to treat your input as possible with a typo or as a start of a complete place name. For example, if your search query is “koln” and the language is set to German, then the result will include “Köln” but won’t include places like “Kolin” (in Czechia) or “Kola” (in Russia).
  • types- Because every country in the world has a different way of hierarchical division, it is not possible to design a universal one that fits every country. Maptiler Geocoding tries to approach this by defining an approximate global hierarchy where it maps every country by best effort. Not every country has administrative areas present at every level. For a list of accepted values of the types parameter, go to the API reference.
On this page

    Was this helpful?