本文介绍了仅列出城市名称Geocomplete.js或Google Location Autocomplete的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想使用Geocomplete.js显示城市名称.我将搜索限制为仅显示城市.但它仍在末尾显示国家名称美国",我想摆脱它.

I want to only show the cities name using Geocomplete.js. I have restrict the search to only show the cities. But it is still showing the Country name "United State" at the end, i want to get rid from it.

请提出任何建议

谢谢

推荐答案

很高兴我终于找到geocomplete.js的解决方案!希望对某人有用.

Glad that I finally found solution for geocomplete.js! Hope it will be useful to someone.

解决方案:发送具有地理完整性功能所需限制的选项:

Solution: Send options with restrictions required to geocomplete function:

     var options = {
              types: ['(cities)'],
              componentRestrictions: {}
          };

     $("#source").geocomplete(options);

您还可以发送基于国家/地区的限制.带有

You can also send country-based restrictions. with Options like

var options = {
          types: ['(cities)'],
          componentRestrictions: {country: ["usa"]}
      };

使用Google Places API解决方案的Google位置自动完成功能非常简单,并且

Google Location Autocomplete using google places api solutions was straightforward and here is the answer

这篇关于仅列出城市名称Geocomplete.js或Google Location Autocomplete的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 11:09