Edgar Froes
Edgar Froes

Reputation: 778

Google Places API - Nearby Search not filtering by type

The following URL Request is not filtering places by their types:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=establishment&location=-15.8374808,-48.0125697&radius=100&key=[YOUR_API_KEY_HERE]

The query string type=establishment is not filtering property.

Note: insert your Google API Key in the end for search.

Edit: I believe only the first result is not in the filtered type. It's the state.

Upvotes: 1

Views: 1156

Answers (1)

evan
evan

Reputation: 5701

The establishment type is not in the list of supported types for place searches.

So your query is ignoring this type filter as if you were making the following typeless request:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-15.8374808,-48.0125697&radius=100&key=KEY

You'll need to use a supported type such as e.g. store:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=store&location=-15.8374808,-48.0125697&radius=100&key=KEY

Hope this helps!

Upvotes: 1

Related Questions