Reputation: 431
I am using google places Api. I want to have only the airports of particular country to displayed by autocomplete api. Is there any way to achieve this?
Upvotes: 5
Views: 4146
Reputation: 1346
For a place search, you can apply a type filter from within a predefined list (airport included): https://developers.google.com/places/supported_types
The place search doesn't allow country filtering (it uses latlng + radius params instead), but using the country name as the query term should yield the correct results.
However, this doesn't apply to the autocomplete API so you'll probably want to grab the full text search result, cache them client-side and do your own matching/autocomplete.
Upvotes: 1