2017-06-26 111 views
0

Google的API一直在爲特定國家內的城市提供良好的搜索服務。這發生在服務器端。但是,由於某些原因,在香港沒有發現任何東西。例如,搜尋香港的九龍城,會返回一個空的數組。這裏是請求:Google Places API自動填充功能不適用於香港?

GET /maps/api/place/autocomplete/json?input=Kowloon&key=...&types=(cities)&components=country:hk 

這個請求格式對其他國家很好。香港爲什麼會有不同的表現?

回答

1

它看起來好像是與(cities)類型的限制。我不知道爲什麼。

例如:

const options = { 
    componentRestrictions: {country: 'hk'}, 
    types: ['(cities)'], 
} 

不起作用。但是:

const options = { 
    componentRestrictions: {country: 'hk'}, 
} 

確實

相關問題