The Place Autocomplete service is a web service that returns place predictions in response to an HTTP request. The request specifies a textual search string and optional geographic bounds. The service can be used to provide autocomplete functionality for text-based geographic searches, by returning places such as businesses, addresses and points of interest as a user types.
google_place_autocomplete(
place_input,
location = NULL,
radius = NULL,
language = NULL,
place_type = NULL,
components = NULL,
simplify = TRUE,
curl_proxy = NULL,
key = get_api_key("place_autocomplete")
)
string
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.
numeric
vector of latitude/longitude coordinates (in that order)
the point around which you wish to retrieve place information
numeric
The distance (in meters) within which to return
place results. Note that setting a radius biases results to the indicated area,
but may not fully restrict results to the specified area
string
The language code, indicating in which language
the results should be returned, if possible. Searches are also biased to the
selected language; results in the selected language may be given a higher ranking.
See the list of supported languages and their codes
https://developers.google.com/maps/faq#languagesupport
string
Restricts the results to places matching the
specified type. Only one type may be specified (if more than one type is provided,
all types following the first entry are ignored). For a list of valid types,
please visit https://developers.google.com/maps/documentation/places/web-service/autocomplete
string
of length 1 which identifies a grouping of places
to which you would like to restrict your results. Currently, you can use
components to filter by country only. The country must be passed as a two
character, ISO 3166-1 Alpha-2 compatible country code.
For example: components=country:fr would restrict your results to places within France.
logical
- TRUE indicates the returned JSON will be
coerced into a list. FALSE indicates the returend JSON will be returned as a string
a curl proxy object
string
A valid Google Developers Places API key
if (FALSE) {
## search for 'Maha' Restaurant, Melbourne
google_place_autocomplete("Maha Restaurant", key = key)
## search for 'Maha' Restaurant, exclusively in Australia
google_place_autocomplete("maha Restaurant", component = "au", key = key)
}
Run the code above in your browser using DataLab