[英]componentRestrictions is not working with placeId in reverse Geocoding in google maps
[英]Google maps componentRestrictions not working
我正在使用google maps javascript api將帶有componentRestrictions設置的SearchBox放置到國家cz。
但是,所有國家/地區都可以自動完成。
const AUTOCOMPLETE_OPTIONS = {
types: ['address'],
componentRestrictions: {
country: 'cz'
}
};
new google.maps.places.SearchBox(inputPlaceElement, AUTOCOMPLETE_OPTIONS);
如果將創建的對象轉儲到控制台componentRestrictions的設置是我想要的,但是在請求url中沒有關於此限制的任何內容,應該有GetPredictions而不是GetQueryPredictions:
https://maps.googleapis.com/maps/api/js/AutocompletionService.GetQueryPredictions?1sb&4scs&15e3
我不確定這里的問題是什么,如果我設置了其他國家/地區代碼,那么它也不起作用。
SearchBox
不支持componentRestrictions
,此選項適用於Autocomplete
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.