Reputation:
This question is an update to some outdated questions:
Because I need a way to get all near restaurants, stores, and churches I thought Google Places API seemed to do what I want, but I am having some trouble with filtering: I want to search for multiple places-types in one request.
let url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?"
url += "location=" + 79.999 + "," + 8.999
url += "radius=" + 2000
url += "type=" + mytype// ??
url += "key=" + mykey
This is what my url should look like. But I got trouble setting multiple types like:
Setting mytype
to maybe "restaurant" is working quite fine.
Setting mytype
to "restaurant,store,church" is not working.
Setting mytype
to "[restaurant,store,church]" is also not working.
I know that the feature searching for multiple place types was disabled by Google a long time ago. But using the javascript API works absolutely fine with multiple types so the URL request probably should also work this way.
Upvotes: 2
Views: 3668
Reputation: 63
Using multiple types is not possible in Google Places
https://developers.google.com/places/web-service/search
Go through the above link:
Under Nearby Search requests section you will find the answer.
Upvotes: -1
Reputation: 1113
Seperating the types with "|"
is doing the job.
let mytype = "restaurant|food|store"
let url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?"
url += "location=" + 79.999 + "," + 8.999
url += "radius=" + 2000
url += "type=" + mytype// ??
url += "key=" + mykey
Volià, hope I could help.
Upvotes: 1