Localities Widget Reference 1.0 (Deprecated)

Localities Javascript Widget Reference 1.0
  1. Autocomplete class 
  2. AutocompleteLocalities object Specification 
  3. AutocompleteParameters object Specification 
  4. AutocompleteResponse object Specification 
  5. ComponentRestrictions object Specification 

Autocomplete class 🔗


Autocomplete(inputId:String, customConfig?:AutocompleteParameters)

addListener(eventName, callback)

Return Value: Event

Adds an event listener to the widget Can be removed using removeListener() with the same arguments


Return Value: AutocompleteResponse

Returns the latest search results


Return Value: AutocompleteLocalities

Returns the latest user-selected locality among search results

removeListener(eventName, callback)

Removes given event listener from the widget


Sets the component restrictions


Sets new config options


Sets the types to query

AutocompleteLocalities object Specification  🔗

admin_0 Type: String

The country name associated to the prediction

admin_1 Type: String

The area name associated to the prediction

description Type: String

The suggested formatted answer

location Type: Latlngliteral

The location object

name Type: String

The location name

postal_codes Type: String|Array.<String>

Array of postal codes for suggested location (only returned for localities predictions)

postal_town Type: String

The largest city (or the post office city) for a postal_code (only returned for postal_code predictions).

type Type: String

requested prediction type (‘locality’, ‘postal_code’, ‘country’, ‘admin_level’, ‘train_station’, ‘metro_station’, ‘shopping’, ‘airport’, ‘museum’, ‘zoo’, ‘amusement_park’, ‘art_gallery’, ‘tourist_attraction’)

viewpoint Type: Latlngboundsliteral

The preferred viewpoint when displaying this Locality on a map. This property will be null if the preferred viewport for the Locality is not known.

AutocompleteParameters object Specification  🔗

minLength Type: Number

Number of characters before sending request to Localities API

customDescription Type: String|Array.<String>

Sets custom description using one or more response field (see AutocompleteLocalities object Specification). Selected field should be string or array of string. Field ‘description’ can not be selected.

components Type: ComponentRestrictions

restricts predictions to selected components

types Type: String|Array.<String>

The types queried (example ‘locality’, ‘postal_code’, ‘country’ ; omit param for ‘locality’ + ‘postal_code’)

data Type: String

Defaults to ‘standard’, can be set to ‘advanced’ to retrieve postal codes outside western Europe

extended Type: String

can be set to ‘postal_code’ to search localities by name or postal codes

language Type: String

expected response language. Default is the country local or browser language

firstTabIndex Type: Number

all tabindexes in Autocomplete will start from that tabindex. Defaults to 0.

debounceTime Type: Number

prevents autocomplete requests from being sent unnecessarily often. Default is no debounce.

AutocompleteResponse object Specification  🔗

localities Type: AutocompleteLocalities

Array with Autocomplete Localities

ComponentRestrictions object Specification  🔗

country Type: String|Array.<String>

Restricts predictions to the specified country (ISO 3166-1 Alpha-2 country code, case insensitive). For example, ‘fr’, ‘gb’, or ‘es’. You can provide a single one, or an array of country code strings.

Was this article helpful?
Have more questions? Submit a request