【发布时间】:2017-08-13 23:58:15
【问题描述】:
我尝试在我的应用程序中使用 Google Place 的自动完成 API,但在将结果过滤为特定类型(即 restaurant)时遇到问题。
每当我将types 参数更改为establishment 以外的其他参数时,我都会收到INVALID_REQUEST 响应。
但是,当我对附近的所有餐馆进行标准搜索时,显示的结果与相同的自动填充结果匹配。
示例:Applebee's at 555 Saratoga Avenue, San Jose, CA 出现在我的 nearby 搜索和我的 autocomplete 搜索中,但在 autocomplete API 响应中只有 establishment 类型,而它在标准搜索 API 响应中有 restaurant。
还有其他人遇到此问题或知道解决方法吗? API Docs 听起来好像所有有效类型都应该在自动完成 API 请求中是可接受的。
这是我使用type=restaurant 的网址,但总是失败:
https://maps.googleapis.com/maps/api/place/autocomplete/json?types=restaurant&input=applebee&radius=48280.2&rankby=distance&key=MY_API_KEY&location=37.33233141,-122.0312186
这是使用type=establishment 的有效网址:
https://maps.googleapis.com/maps/api/place/autocomplete/json?types=establishment&input=applebee&radius=48280.2&rankby=distance&key= MY_API_KEY&location=37.33233141,-122.0312186
【问题讨论】:
标签: types autocomplete google-places-api