Jim*_*med 6 types autocomplete google-places-api
我正在尝试在我的应用中使用Google Place的自动填充API,但是在将结果过滤到特定类型(即restaurant)时遇到了问题.
无论何时我将types参数更改为其他内容establishment,我都会收到INVALID_REQUEST回复.
但是,当我对附近的所有餐馆进行标准搜索时,显示的结果会匹配相同的自动完成结果.
例如:阿普尔比的555萨拉托加大道,加利福尼亚州圣何塞,显示在我的nearby搜索,我的autocomplete搜索,但只有类型establishment的autocompleteAPI响应,同时它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)
是的餐厅类型参数不起作用 /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