Search code examples
geocodinghere-apiautosuggest

Geocoding or Search for IATA airport code


Is it possible to search for an airport using its IATA airport code using the HERE geocoding REST API? It's not well documented in the API reference.

The following return no hits for Pune, India's IATA airport code PNQ for example:

curl -s "https://geocode.search.hereapi.com/v1/geocode?apiKey=<apiKey>&in=countryCode%3AIND&q=PNQ" 

The web interface does show the right "category:airport" suggestion though, as seen in this screenshot.

More examples that don't work: FRA (Frankfurt) with country filter DEU, NRT (Tokyo Narita) with country filter JPN, PEK (Beijing) with country CHN.

IAD for USA works, so do DUB in IRL, and LHR in GBR for example.


Solution

  • The autosuggest or discover API is more suitable for your use case. Here are the samples:

    https://autosuggest.search.hereapi.com/v1/autosuggest?apiKey={{YOUR_API_KEY}}&in=countryCode:IND&q=PNQ&at=34.0544,-118.244

    https://discover.search.hereapi.com/v1/discover?apiKey={{YOUR_API_KEY}}&in=countryCode:IND&q=PNQ&at=34.0544,-118.244

    The above requests can return the airports successfully.

    Please note that you need to add the "at" parameter that presents the user's current location. If the user's location is unavailable, you can set up a default position.

    In addition, please be aware that China & Japan are not fully covered. To understand the different quality levels of coverage in each country/region, please read the following doc.

    https://developer.here.com/documentation/geocoding-search-api/dev_guide/topics/search-local-coverage.html