admin管理员组文章数量:1297026
I am trying to build an auto-plete for airports using Googles auto-plete 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'],
};
autoplete = new google.maps.places.Autoplete(input, options);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<input id="searchTextField" type="text" size="50" placeholder="Search for an Airport!">
Can anyone help me?
I am trying to build an auto-plete for airports using Googles auto-plete 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'],
};
autoplete = new google.maps.places.Autoplete(input, options);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<input id="searchTextField" type="text" size="50" placeholder="Search for an Airport!">
Can anyone help me?
Share Improve this question edited May 23, 2017 at 10:30 CommunityBot 11 silver badge asked Nov 21, 2014 at 20:37 ilse2005ilse2005 11.4k5 gold badges55 silver badges75 bronze badges 2- Seems this is known issues code.google./p/gmaps-api-issues/issues/detail?id=7126 – Alex Filatov Commented Nov 21, 2014 at 21:00
- Thank you. I hope they will fix this soon. I will keep this thread updated. – ilse2005 Commented Nov 21, 2014 at 23:21
2 Answers
Reset to default 4There is no airport
place type.
https://developers.google./maps/documentation/javascript/reference#AutopleteOptions
types
|Array.<string>
The types of predictions to be returned. For a list of supported types, see the developer's guide. 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.
Types supported in place autoplete requests
In order to acplish this you can use the airport type for google place searches. Then use the results to implement your own autoplete dropdown. Autoplete does not support it at the time (https://developers.google./places/supported_types) but places search does.
本文标签: javascriptGoogle Places autocomplete for AirportsStack Overflow
版权声明:本文标题:javascript - Google Places autocomplete for Airports - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741648780a2390348.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论