Localities Reference 2.0
Localities Javascript API Reference 2.0- AutocompleteService class
- AutocompleteLocalities Interface
- AutocompleteParameters Interface
- AutocompleteRequest Interface
- AutocompleteResponse Interface
- AutocompleteResponseItem Interface
- ComponentRestrictions Interface
- DetailsResponseItem Interface
- ErrorAutocompleteCallback Interface
- ErrorDetailsCallback Interface
- MatchedElements Interface
- MatchedSubstring Interface
- SuccessAutocompleteCallback Interface
- SuccessDetailsCallback Interface
AutocompleteService class
woosmap.localities.AutocompleteServiceAutocompleteService
| Constructor |
AutocompleteService(key)Parameters:
|
| Methods | |
autocomplete(params, callbackSuccess, callbackError, debounceTime)Parameters:
Get the suggestions array from an input value. | |
getDetails(publicId, callbackSuccess, callbackError)Parameters:
Get the details of a Localities Item from its | |
AutocompleteLocalities Interface
| Properties | |
|
Type:
StringThe country name associated to the prediction | |
|
Type:
StringThe area name associated to the prediction | |
|
Type:
StringThe suggested formatted answer | |
|
Type:
LatLngLiteralThe location object | |
|
Type:
StringThe location name | |
|
Type:
StringArray of postal codes for suggested location (only returned for localities predictions) | |
|
Type:
StringThe largest city (or the post office city) for a postal_code (only returned for postal_code predictions). | |
|
Type:
Stringrequested prediction type (‘locality’, ‘postal_code’, ‘country’, ‘admin_level’, ‘train_station’, ‘metro_station’, ‘shopping’, ‘airport’, ‘museum’, ‘zoo’, ‘amusement_park’, ‘art_gallery’, ‘tourist_attraction’) | |
|
Type:
LatLngBoundsLiteralThe 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:
ComponentRestrictionsrestricts predictions to selected components | |
|
Type:
StringSets 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. | |
|
Type:
StringDefaults to ‘standard’, can be set to ‘advanced’ to retrieve postal codes outside western Europe | |
|
Type:
Numberprevents autocomplete requests from being sent unnecessarily often. Default is no debounce. | |
|
Type:
Stringcan be set to ‘postal_code’ to search localities by name or postal codes | |
|
Type:
Numberall tabindexes in Autocomplete will start from that tabindex. Defaults to 0. | |
|
Type:
Stringexpected response language. Default is the country local or browser language | |
|
Type:
NumberNumber of characters before sending request to Localities API | |
|
Type:
StringThe types queried (example ‘locality’, ‘postal_code’, ‘country’ ; omit param for ‘locality’ + ‘postal_code’) | |
AutocompleteRequest Interface
| Properties | |
|
Type:
ComponentRestrictionsrestricts suggestions to selected components | |
|
Type:
StringThis parameter allows to choose the description format for all or some of the suggestion types selected. The custom formats are described as follows:
| |
|
Type:
StringDefaults to ‘standard’, can be set to ‘advanced’ to retrieve postal codes outside western Europe | |
|
Type:
Stringcan be set to ‘postal_code’ to search localities by name or postal codes | |
|
Type:
StringUser input | |
|
Type:
Stringexpected response language. Default is the country local or browser language | |
|
Type:
StringThe types queried (example ‘locality’, ‘postal_code’, ‘country’ ; omit param for ‘locality’ + ‘postal_code’) | |
AutocompleteResponse Interface
| Properties | |
|
Type:
AutocompleteResponseItemArray with Autocomplete items | |
AutocompleteResponseItem Interface
| Properties | |
|
Type:
StringThe suggested formatted answer | |
|
Type:
arrayContains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired. | |
|
Type:
StringItem identifier | |
|
Type:
Stringrequested suggestion type (‘locality’, ‘postal_code’, ‘country’, ‘admin_level’, ‘train_station’, ‘metro_station’, ‘shopping’, ‘airport’, ‘museum’, ‘zoo’, ‘amusement_park’, ‘art_gallery’, ‘tourist_attraction’, ‘address’) | |
ComponentRestrictions Interface
| Properties | |
|
Type:
StringRestricts suggestions 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. | |
DetailsResponseItem Interface
| Properties | |
|
Type:
arrayArray containing the separate components applicable to this address. Each component has a long name (full text description or name of the address component), a short name (abbreviated textual name for the address component, if available) and types (array indicating the type of the address component like | |
|
Type:
stringString containing the human-readable address of this item. | |
|
Type:
objectItem geometry ( | |
|
Type:
stringItem name | |
|
Type:
stringItem identifier | |
|
Type:
arrayTypes of the given item (like | |
ErrorAutocompleteCallback Interface
FunctionCallback executed when autocomplete query fails
| Function |
ErrorAutocompleteCallback(errorCode, errorText)Parameters:
Callback executed when autocomplete query fails |
ErrorDetailsCallback Interface
FunctionCallback executed when details query fails
| Function |
ErrorDetailsCallback(errorCode, errorText)Parameters:
Callback executed when details query fails |
MatchedElements Interface
| Properties | |
|
Type:
MatchedSubstring[](optional) A set of substrings that match the description field | |
MatchedSubstring Interface
| Properties | |
|
Type:
NumberThe length of the substring | |
|
Type:
NumberThe offset to the substring’s start within the AutocompleteLocalities field string | |
SuccessAutocompleteCallback Interface
FunctionCallback executed when autocomplete query is successful
| Function |
SuccessAutocompleteCallback(autocompleteResponse)Parameters:
Callback executed when autocomplete query is successful |
SuccessDetailsCallback Interface
FunctionCallback executed when details query is successful
| Function |
SuccessDetailsCallback(autocompleteResponse)Parameters:
Callback executed when details query is successful |