I'm trying to use the Google Places API via the Googleway package in R to search for certain businesses (for example, gyms) nearby a location coordinate. It's important that the results are returned ranked by distance to that point, so I'm using the optional parameter rankby="distance". According to the documentation, if I'm using rankby="distance", radius must not be included, and if I include a search_string then rankby will be ignored. Also, I must include one of keyword, name, or place_type. Here is a snippet of my code:
df_places <- google_places(rankby = "distance",
radar = FALSE,
keyword = "fitness",
place_type = "gym",
location = c(lat, lon),
key = key)
lat and lon are variables specified beforehand, so those are fine. However I get this error message and can't figure out why:
Error in validateLocationSearch(location, search_string, radius, rankby, :
you must specify a radius if only using a 'location' search
I think this is a flaw in the package, not my code, because if I specified a radius the rankby="distance" would be ignored, and I am already specifying both place type and keyword. My only idea here is that perhaps rankby="distance" is not available for a Nearby Search (aka 'location' search). However that means it wouldn't work for any search type, since the other two are radar search (which requires radius) and text search (which requires search_string).
Am I overlooking something or is this broken? Any help or ideas would be greatly appreciated!