srisindhu saride
srisindhu saride

Reputation: 431

Google places API to get airport names in autocomplete

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

Answers (1)

Matt O
Matt O

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.

https://maps.googleapis.com/maps/api/place/textsearch/json?query=Australia&key=addkeyhere&type=airport

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

Related Questions