2017-06-26 109 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'}, 
} 

确实

相关问题