2016-02-12 51 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 
});