Localities Reference 1.0 (Deprecated)

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

AutocompleteService class

woosmap.localities.AutocompleteService

Localities Service to help you call the Localities API.

Constructor
AutocompleteService(apiKey)
Parameters:
  • apiKey: String Woosmap Public Key of your project

Instantiate a new AutocompleteService Object


Methods
getQueryPredictions(params, callback, errorCallback, debounceTime)
Parameters:
  • params: AutocompleteRequest query parameters
  • callback: SuccessCallback executed on success
  • errorCallback: ErrorCallback executed on failure
  • debounceTime: Number prevents autocomplete requests from being sent unnecessarily often. Default is no debounce.

Get the predictions array from an input value.


AutocompleteLocalities Interface

Properties
Type: String

The country name associated to the prediction

Type: String

The area name associated to the prediction

Type: String

The suggested formatted answer

The location object

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.

Type: String

The location name

Type: String | String[]

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

Type: String

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

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’)

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 Interface

Properties
Type: String

the public key of your Woosmap project. To use this parameter a dedicated option on your licence is needed. Please contact us if you are interested in using this parameter and you do not have subscribed the proper option yet.

restricts predictions to selected components

Type: String

the data set to use, accepted values standard, advanced.

Type: String

param to extend the search, accepted value is postal_code to enable search of localities by name or postal code.

Type: String

Value to search for predictions

Type: String

expected response language

Type: String | String[]

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


AutocompleteRequest Interface

Properties

restricts predictions to selected components

Type: String

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

Type: String

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

Type: String

User input

Type: String

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

Type: String | 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’)


AutocompleteResponse Interface

Properties

Array with Autocomplete Localities


ComponentRestrictions Interface

Properties
Type: String | 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 Interface

Type: Function

Callback executed when query fails

Function
ErrorCallback(errorCode, errorText)
Parameters:
  • errorCode: Number the http error code
  • errorText: String the error description

Callback executed when query fails


LatLngBoundsLiteral Interface

Properties
Type: String

The east value

Type: String

The north value

Type: String

The south value

Type: String

The west value


LatLngLiteral Interface

Properties
Type: String

The latitude value

Type: String

The longitude value


MatchedElements Interface

Properties

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

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

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

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

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


MatchedSubstring Interface

Properties
Type: Number

The length of the substring

Type: Number

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


SuccessCallback Interface

Type: Function

Callback executed when query is successful

Function
SuccessCallback(autocompleteResponse)
Parameters:

Callback executed when query is successful


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