Localities Widget Reference

Localities Javascript Widget Reference
  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’ or ‘postal_code’)

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

How description will be written. Not used yet.

components Type: ComponentRestrictions

restricts predictions to selected components

types Type: String

The types queried (supports ‘locality’ and ‘postal_code’ ; omit param for both)

data Type: String

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

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.

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.