ilse2005 ilse2005 - 1 year ago 518
Javascript Question

Google Places autocomplete for Airports

I am trying to build an auto-complete for airports using Googles auto-complete places API.
I found the following code in an question here, but it returns no results:
Setting Google Places 'Types' on Dropdown Input

<script type="text/javascript">
function initialize()
var input = document.getElementById('searchTextField');
var options = {
types: ['airport'],


autocomplete = new google.maps.places.Autocomplete(input, options);

google.maps.event.addDomListener(window, 'load', initialize);
<input id="searchTextField" type="text" size="50" placeholder="Search for an Airport!">

Can anyone help me?

Answer Source

There is no airport place type.

types | Array.<string>

The types of predictions to be returned. Four types are supported: 'establishment' for businesses, 'geocode' for addresses, '(regions)' for administrative regions and '(cities)' for localities. If nothing is specified, all types are returned. In general only a single type is allowed. The exception is that you can safely mix the 'geocode' and 'establishment' types, but note that this will have the same effect as specifying no types.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download