google_places.Rd
The Google Places API Web Service allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more.
google_places(search_string = NULL, location = NULL, radius = NULL, rankby = NULL, keyword = NULL, language = NULL, name = NULL, place_type = NULL, price_range = NULL, open_now = NULL, page_token = NULL, simplify = TRUE, curl_proxy = NULL, key = get_api_key("places"), radar = NULL)
search_string |
|
---|---|
location |
|
radius |
|
rankby |
|
keyword |
|
language |
|
name |
|
place_type |
|
price_range |
|
open_now |
|
page_token |
|
simplify |
|
curl_proxy | a curl proxy object |
key |
|
radar | deprecated, no longer used |
A Nearby Search (using google_places
) lets you search for places within a specified area.
You can refine your search request by supplying keywords or specifying the type of place you are searching for.
With the Places service you can perform three kinds of searches:
Nearby Search
Text Search
Place Details request
A Nearby search lets you search for places within a specified area or by keyword.
A Nearby search must always include a location
, which can be specified
as a point defined by a pair of lat/lon coordinates, or a circle defined by a
point and a radius
.
A Text search returns information about a set of places based on the search_string
.
The service responds with a list of places matching the string and any location
bias that has been set.
A Place Detail search (using google_place_details) can be performed when
you have a given place_id
from one of the other three search methods.
radius
- Required when only using a location
search, radius
defines the distance (in meters) within which to return place results. The maximum
allowed radius is 50,000 meters. Note that radius must not be included if
rankby = distance
is specified.
radius
- Optional when using a search_string
. Defines the distance
(in meters) within which to bias place results. The maximum allowed radius is
50,000 meters. Results inside of this region will be ranked higher than results
outside of the search circle; however, prominent results from outside of the
search radius may be included.
The Google Places API Web Service enforces a default limit of 1,000 free requests per 24 hour period, calculated as the sum of client-side and server-side requets. See https://developers.google.com/places/web-service/usage for details.
Use of the Places Library must be in accordance with the polices described for the Google Places API Web Service https://developers.google.com/places/web-service/policies
The amount of queries you can make to Google's APIs is dependent on both the service and the API you are using.
Each API has specific quotas and limits. Check Google's API documentation for details.
View your usage at the Google Cloud Console https://console.cloud.google.com/
Each API can only accept and return one request at a time. If you write a loop to make multiple API calls you should ensure you don't go over your quota / limits during the loop.
# NOT RUN { ## query restaurants in Melbourne (will return 20 results) api_key <- 'your_api_key' res <- google_places(search_string = "Restaurants in Melbourne, Australia", key = api_key) ## use the 'next_page_token' from the previous search to get the next 20 results res_next <- google_places(search_string = "Restaurants in Melbourne, Australia", page_token = res$next_page_token, key = api_key) ## search for a specific place type google_places(location = c(-37.817839,144.9673254), place_type = "bicycle_store", radius = 20000, key = api_key) ## search for places that are open at the time of query google_places(search_string = "Bicycle shop, Melbourne, Australia", open_now = TRUE, key = api_key) # }