SymbolixAU / googleway

R Package for accessing and plotting Google Maps
http://symbolixau.github.io/googleway/
Other
234 stars 46 forks source link

Incomplete google places results #239

Closed arthurgailes closed 3 years ago

arthurgailes commented 3 years ago

Hello,

The below query only returns 60 results (3 dataframes of 20). Is there an alternate way to do bulk queries?

rest_list = list()
i = 0
token <- NULL
while(i < 50){
  rest <- google_places(search_string = "restaurants in Washington, DC",
    page_token = token,
    key = key)

  rest_list[[length(rest_list) + 1]] <- rest
  if(is.null(rest$next_page_token)) break

  token <- rest$next_page_token
  i = i + 1
  Sys.sleep(5) # doesn't work at all without this, raising to 60 made no difference
}
dcooley commented 3 years ago

I am not aware of a better way to do this. As far as I know you have to use the token and iterate through the pages of results.

arthurgailes commented 3 years ago

Thanks. I'm more asking if there's anything else I can need to do with the package to get the full result set, as opposed to getting cut off like I am here.

dcooley commented 3 years ago

oh I see. I think Google limits it to 60. I can't find exactly where this is documented, but this SO question has a couple of links to google's issue tracker etc.

arthurgailes commented 3 years ago

Ah. Apologies for a non-relevant question, then. Thank you for pointing me in the right direction.