2016-02-12 46 views
0

我使用的是Google地图,我想限制用户搜索结果仅限澳大利亚。例如,如果用户输入“墨尔本”,目前它将重定向到墨尔本在美国的位置。另外,邮编3000正在重定向到欧洲的一些国家。商店定位器 - 限制用户搜索到澳大利亚

我们如何限制这些问题? Google地图应该启用哪些选项。

注意:我没有为此使用任何API密钥。如果我们有API密钥,我们可以限制人们到澳大利亚吗?

+0

可能重复:http://stackoverflow.com/questions/717019/how-to-display-only-one-country-or-a-specific-area-in-google -maps-using-the-api –

+0

不,这与我的问题不相似。我正在使用[Bjorn博客的商店定位器](http://bjornblog.com/web/jquery-store-locator-plugin)。请参考上面的链接。 – Kiran

回答

0

此问题已解决。我使用componentRestrictions更改了地理编码搜索。 请参见下面的代码:

g.geocode({'address': addressInput, componentRestrictions: {country: region}}, function (data) { 
// add your code here 
});