user9225081
user9225081

Reputation:

Google places: Use multiple types

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

Answers (2)

Manoj Kumar M
Manoj Kumar M

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

Jonas0000
Jonas0000

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

Related Questions