google_places

0th

Percentile

Google places

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.

Usage
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)
Arguments
search_string

string A search term representing a place for which to search. If blank, the location argument must be used.

location

numeric vector of latitude/longitude coordinates (in that order) around which to retrieve place information.

radius

numeric Defines the distance (in meters) within which to return place results. Required if only a location search is specified. The maximum allowed radius is 50,000 meters. Radius must not be included if rankby is used. see Details.

rankby

string Specifies the order in which results are listed. Possible values are "prominence" or "distance". If rankby = distance, then one of keyword, name or place_type must be specified. If a search_string is used then rankby is ignored.

keyword

string A term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.

language

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.

name

string vector One or more terms to be matched against the names of places. Ignored when used with a search_string. Results will be restricted to those containing the passed name values. Note that a place may have additional names associated with it, beyond its listed name. The API will try to match the passed name value against all of these names. As a result, places may be returned in the results whose listed names do not match the search term, but whose associated names do.

place_type

string Restricts the results to places matching the specified type. Only one type may be specified. For a list of valid types, please visit https://developers.google.com/places/supported_types.

price_range

numeric vector Specifying the minimum and maximum price ranges. Values range between 0 (most affordable) and 4 (most expensive).

open_now

logical Returns only those places that are open for business at the time the query is sent. Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.

page_token

string Returns the next 20 results from a previously run search. Setting a page_token parameter will execute a search with the same parameters used in a previous search. All parameters other than page_token will be ignored. The page_token can be found in the result set of a previously run query.

simplify

logical - TRUE indicates the returned JSON will be coerced into a list. FALSE indicates the returend JSON will be returned as a string into a list.

curl_proxy

a curl proxy object

key

string A valid Google Developers Places API key.

radar

deprecated, no longer used

Details

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.

Note

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

API use and limits

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.

See Also

google_place_details google_find_place

Aliases
  • google_places
Examples
# 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)

# }
Documentation reproduced from package googleway, version 2.7.1, License: GPL-3

Community examples

Looks like there are no examples yet.