Localities Reference 1.0 (Deprecated)

Localities Javascript API Reference 1.0
  1. AutocompleteService class 
  2. AutocompleteLocalities object Specification 
  3. AutocompleteRequest object Specification 
  4. AutocompleteResponse object Specification 
  5. ComponentRestrictions object Specification 
  6. ErrorCallback function definition 
  7. LatLngBoundsLiteral object Specification 
  8. LatLngLiteral object Specification 
  9. MatchedElements object Specification 
  10. MatchedSubstring object Specification 
  11. SuccessCallback function definition 

AutocompleteService class 🔗



Instantiate a new AutocompleteService Object

getQueryPredictions(params:AutocompleteRequest, callback:SuccessCallback, errorCallback:ErrorCallback, debounceTime:Number)

Get the predictions array from an input value.

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

Contains the larger city (or the post office city) for a postal_code (only available on suggestions with type: postal_code).

type Type: String

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

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.

matched_substrings Type: MatchedElements

A set of substrings of each field (description, name, admin_0, admin_1) that match elements in the input. It can be used to highlight those substrings. Each substring is identified by an offset and a length.

AutocompleteRequest object Specification  🔗

input Type: String

User input

components Type: ComponentRestrictions

restricts predictions to selected components

types Type: String|Array.<String>

The types queried (supports ‘locality’, ‘postal_code’, ‘country’, ‘admin_level’, ‘train_station’, ‘metro_station’, ‘shopping’, ‘museum’, ‘zoo’, ‘amusement_park’, ‘art_gallery’, ‘tourist_attraction’ and ‘airport’ ; 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 code

language Type: String

expected response language (ISO 639-1 code). Default is the country local or browser language.

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.

ErrorCallback function definition  🔗



Callback executed when query fails

LatLngBoundsLiteral object Specification  🔗

east Type: String

The east value

north Type: String

The north value

south Type: String

The south value

west Type: String

The west value

LatLngLiteral object Specification  🔗

lat Type: String

The latitude value

lng Type: String

The longitude value

MatchedElements object Specification  🔗

description Type: [ 'Array' ].<MatchedSubstring>

(optional) A set of substrings that match the description field

name Type: [ 'Array' ].<MatchedSubstring>

(optional) A set of substrings that match the name field

admin_0 Type: [ 'Array' ].<MatchedSubstring>

(optional) A set of substrings that match the admin_0 field

admin_1 Type: [ 'Array' ].<MatchedSubstring>

(optional) A set of substrings that match the admin_1 field

postal_town Type: [ 'Array' ].<MatchedSubstring>

(optional) A set of substrings that match the postal_town field

MatchedSubstring object Specification  🔗

offset Type: Number

The offset to the substring’s start within the AutocompleteLocalities field string

length Type: Number

The length of the substring

SuccessCallback function definition  🔗



Callback executed when query is successful

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