相关疑难解决方法(0)

如何将Google自动填充结果限制为仅限城市和国家/地区

我正在使用谷歌自动填充地点javascript返回我的搜索框的建议结果,我需要的是只显示与输入的字符相关的城市和国家但谷歌api将给出很多我不需要的一般地方结果,所以如何限制结果只显示城市和国家.

我使用以下示例:

<html>
<head>
<style type="text/css">
   body {
         font-family: sans-serif;
         font-size: 14px;
   }
</style>

<title>Google Maps JavaScript API v3 Example: Places Autocomplete</title>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places" type="text/javascript"></script>
<script type="text/javascript">
   function initialize() {
      var input = document.getElementById('searchTextField');
      var autocomplete = new google.maps.places.Autocomplete(input);
   }
   google.maps.event.addDomListener(window, 'load', initialize);
</script>

</head>
<body>
   <div>
      <input id="searchTextField" type="text" size="50" placeholder="Enter a location" autocomplete="on">
   </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

javascript autocomplete google-maps-api-3

189
推荐指数
8
解决办法
23万
查看次数

Google地方信息自动填充功能需要多个国家/地区组件限制

我需要Google商家信息自动填充功能,以便向我提供各国的结果:SZ,FR,DE,AT,IT.我知道componentRestrictions只能在一个国家运作.那么,有没有办法在Google商家信息自动填充功能中获得多个县的结果?

我的页面是从地方自动填充地址表单示例中复制粘贴:

google-maps google-maps-api-3

8
推荐指数
3
解决办法
1万
查看次数