Reputation: 759
I have a travel site that lists the POI of each city. So I use the Google Places API to return points of interest like this:
https://maps.googleapis.com/maps/api/place/search/json?location=45.8150108,15.981919&radius=10000&types=point_of_interest&hasNextPage=true&nextPage()=true&sensor=false&key=My_Key
However, in addition to POI it returns other types like this:
"types": [
"travel_agency",
"real_estate_agency",
"lodging",
"point_of_interest",
"establishment"
],
Which causes returning things like hotels and offices instead of just POI, is there a way to force return just POI ? I tried using type
instead of types
but it still returns other types
.
Upvotes: 2
Views: 2265
Reputation: 32198
Currently you cannot exclude certain types from Places API searches. There is a feature request in the public issue tracker to add this functionality.
https://issuetracker.google.com/issues/35822993
You can star this feature request to add your vote and subscribe to further notifications.
Please note that endpoint https://maps.googleapis.com/maps/api/place/search/json
is not documented.
There are following endpoints for Places API searches:
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
https://maps.googleapis.com/maps/api/place/radarsearch/output?parameters
https://maps.googleapis.com/maps/api/place/textsearch/output?parameters
You should use one of them. Also the types
parameter was deprecated in February 2016:
https://developers.google.com/places/web-service/search#deprecation
Upvotes: 1