query Autocomplete
GET https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=<string>
The Query Autocomplete service can be used to provide a query prediction for text-based geographic searches, by returning suggested queries as you type.
The Query Autocomplete service allows you to add on-the-fly geographic query predictions to your application. Instead of searching for a specific location, a user can type in a categorical search, such as pizza near New York
and the service responds with a list of suggested queries matching the string. As the Query Autocomplete service can match on both full words and substrings, applications can send queries as the user types to provide on-the-fly predictions.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
input | string | (Required) The text string on which to search. The Place Autocomplete service will return candidate matches based on this string and order results based on their perceived relevance. | |
offset | string | The position, in the input term, of the last character that the service uses to match predictions. For example, if the input is Google and the offset is 3, the service will match on Goo . The string determined by the offset is matched against the first word in the input term only. For example, if the input term is Google abc and the offset is 3, the service will attempt to match against Goo abc . If no offset is supplied, the service will use the whole term. The offset should generally be set to the position of the text caret. | |
location | string | The point around which to retrieve place information. This must be specified as latitude,longitude . |
<div class="note">The <code>location</code> parameter may be overriden if the <code>query</code> contains an explicit location such as <code>Market in Barcelona</code>. Using quotes around the query may also influence the weight given to the <code>location</code> and <code>radius</code>.</div>
|
| radius
| string | | Defines the distance (in meters) within which to return place results. You may bias results to a specified circle by passing a location
and a radius
parameter. Doing so instructs the Places service to prefer showing results within that circle; results outside of the defined area may still be displayed.
The radius will automatically be clamped to a maximum value depending on the type of search and other parameters.
-
Autocomplete: 50,000 meters
-
Nearby Search:
- with
keyword
orname
: 50,000 meters - without
keyword
orname
- Up to 50,000 meters, adjusted dynamically based on area density, independent of
rankby
parameter. - When using
rankby=distance
, the radius parameter will not be accepted, and will result in anINVALID_REQUEST
.
- Up to 50,000 meters, adjusted dynamically based on area density, independent of
- with
-
Query Autocomplete: 50,000 meters
-
Text Search: 50,000 meters | |
language
| string | | The language in which to return results. -
See the list of supported languages. Google often updates the supported languages, so this list may not be exhaustive.
-
If
language
is not supplied, the API attempts to use the preferred language as specified in theAccept-Language
header. -
The API does its best to provide a street address that is readable for both the user and locals. To achieve that goal, it returns street addresses in the local language, transliterated to a script readable by the user if necessary, observing the preferred language. All other addresses are returned in the preferred language. Address components are all returned in the same language, which is chosen from the first component.
-
If a name is not available in the preferred language, the API uses the closest match.
-
The preferred language has a small influence on the set of results that the API chooses to return, and the order in which they are returned. The geocoder interprets abbreviations differently depending on language, such as the abbreviations for street types, or synonyms that may be valid in one language but not in another. For example, utca and tér are synonyms for street in Hungarian. |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Accept | string |
RESPONSES
status: OK
{"predictions":[{"description":"pizza near Paris, France","matched_substrings":[{"length":5,"offset":0},{"length":3,"offset":11}],"structured_formatting":{"main_text":"pizza","main_text_matched_substrings":[{"length":5,"offset":0}],"secondary_text":"near Paris, France","secondary_text_matched_substrings":[{"length":3,"offset":5}]},"terms":[{"offset":0,"value":"pizza"},{"offset":6,"value":"near"},{"offset":11,"value":"Paris"},{"offset":18,"value":"France"}]},{"description":"pizza near Pari Chowk, NRI City, Omega II, Noida, Uttar Pradesh, India","matched_substrings":[{"length":5,"offset":0},{"length":3,"offset":11}],"structured_formatting":{"main_text":"pizza","main_text_matched_substrings":[{"length":5,"offset":0}],"secondary_text":"near Pari Chowk, NRI City, Omega II, Noida, Uttar Pradesh, India","secondary_text_matched_substrings":[{"length":3,"offset":5}]},"terms":[{"offset":0,"value":"pizza"},{"offset":6,"value":"near"},{"offset":11,"value":"Pari Chowk"},{"offset":23,"value":"NRI City"},{"offset":33,"value":"Omega II"},{"offset":43,"value":"Noida"},{"offset":50,"value":"Uttar Pradesh"},{"offset":65,"value":"India"}]},{"description":"pizza near Disneyland Park, Disneyland Drive, Anaheim, CA, USA","matched_substrings":[{"length":5,"offset":0},{"length":3,"offset":22}],"structured_formatting":{"main_text":"pizza","main_text_matched_substrings":[{"length":5,"offset":0}],"secondary_text":"near Disneyland Park, Disneyland Drive, Anaheim, CA, USA","secondary_text_matched_substrings":[{"length":3,"offset":16}]},"terms":[{"offset":0,"value":"pizza"},{"offset":6,"value":"near"},{"offset":11,"value":"Disneyland Park"},{"offset":28,"value":"Disneyland Drive"},{"offset":46,"value":"Anaheim"},{"offset":55,"value":"CA"},{"offset":59,"value":"USA"}]},{"description":"pizza near Cathédrale Notre-Dame de Paris, Parvis Notre-Dame - place Jean-Paul-II, Paris, France","matched_substrings":[{"length":5,"offset":0},{"length":3,"offset":36}],"structured_formatting":{"main_text":"pizza","main_text_matched_substrings":[{"length":5,"offset":0}],"secondary_text":"near Cathédrale Notre-Dame de Paris, Parvis Notre-Dame - place Jean-Paul-II, Paris, France","secondary_text_matched_substrings":[{"length":3,"offset":30}]},"terms":[{"offset":0,"value":"pizza"},{"offset":6,"value":"near"},{"offset":11,"value":"Cathédrale Notre-Dame de Paris"},{"offset":43,"value":"Parvis Notre-Dame - place Jean-Paul-II"},{"offset":83,"value":"Paris"},{"offset":90,"value":"France"}]},{"description":"pizza near Paris Beauvais Airport, Route de l'Aéroport, Tillé, France","matched_substrings":[{"length":5,"offset":0},{"length":3,"offset":11}],"structured_formatting":{"main_text":"pizza","main_text_matched_substrings":[{"length":5,"offset":0}],"secondary_text":"near Paris Beauvais Airport, Route de l'Aéroport, Tillé, France","secondary_text_matched_substrings":[{"length":3,"offset":5}]},"terms":[{"offset":0,"value":"pizza"},{"offset":6,"value":"near"},{"offset":11,"value":"Paris Beauvais Airport"},{"offset":35,"value":"Route de l'Aéroport"},{"offset":56,"value":"Tillé"},{"offset":63,"value":"France"}]}],"status":"OK"}