Google商家信息自动填充API"类型"参数仅适用于商家?

Jim*_*med 6 types autocomplete google-places-api

我正在尝试在我的应用中使用Google Place的自动填充API,但是在将结果过滤到特定类型(即restaurant)时遇到了问题.

无论何时我将types参数更改为其他内容establishment,我都会收到INVALID_REQUEST回复.

但是,当我对附近的所有餐馆进行标准搜索时,显示的结果会匹配相同的自动完成结果.

例如:阿普尔比的555萨拉托加大道,加利福尼亚州圣何塞,显示在我的nearby搜索,我的autocomplete搜索,但只有类型establishmentautocompleteAPI响应,同时它restaurant在标准搜索API响应.

其他人遇到此问题或知道解决方法?API文档听起来好像所有有效类型都应该在自动完成API请求中可接受.

这是我使用的URL 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
Run Code Online (Sandbox Code Playgroud)

以下是使用type=establishment它的URL :

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
Run Code Online (Sandbox Code Playgroud)

And*_*ewR 7

您可以用于自动填充的类型比可用于搜索的类型更受限制."restaurant"不是自动填充的有效地点类型.有效类型是:

  • 地理编码
  • 编制
  • 地址
  • (地区)
  • (城市)

有关详情,请参阅文档中的地方类型.

  • **区域**真的有效吗?我无法通过 **regions** 类型发出请求 (2认同)

Har*_*cha 5

是的餐厅类型参数不起作用 /place/autocomplete/json

如果你想找“餐厅” place/textsearch/json?

添加+后搜索文本

示例 1:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurant+applebee&key={API_KEY}
Run Code Online (Sandbox Code Playgroud)

示例 2:

https://maps.googleapis.com/maps/api/place/radarsearch/json?location=48.859294,2.347589&radius=5000&type=cafe&keyword=vegetarian&key=YOUR_API_KEY
Run Code Online (Sandbox Code Playgroud)

多类型使用 types=food|restaurant

了解更多信息 https://developers.google.com/places/web-service/search