【问题标题】:Google place API autocomplete search with radius as a strict filter使用半径作为严格过滤器的 Google Place API 自动完成搜索
【发布时间】:2017-05-07 07:18:09
【问题描述】:

我想搜索特定位置周围的地点。我尝试使用自动完成搜索 API https://developers.google.com/places/web-service/autocomplete,但它也返回了不在我的搜索范围内的结果。此外,响应不包括地点位置,因此我无法手动删除半径之外的地点。

我也尝试过使用附近搜索(https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters ) 和 textsearch (https://maps.googleapis.com/maps/api/place/textsearch/output?parameters) 但当查询参数具有部分名称时它们不会返回任何结果(例如:使用查询“wa”而不是“walmart”进行搜索)。

是否有任何解决方案可以在对 place api 的 ONE 请求中查找某个位置周围的位置?

【问题讨论】:

  • 我可能有一个想法.. 但是.. 等等.. 不。不,这行不通。对不起朋友
  • 您能出示您的代码吗?您应该能够使用bounds 属性来做您想做的事情。
  • @Brian maps.googleapis.com/maps/api/place/autocomplete/… 用于自动完成。 bounds 属性是什么?在文档中找不到它
  • 抱歉,我指的是 JavaScript API,而不是 Web Service API。对于 WS API,您是否尝试过 strictbounds 参数?
  • @Brian 我使用的是法语版本的文档,但这个参数没有在任何地方记录...我切换到英语版本,就在那里!谢谢,我去试试!

标签: google-maps autocomplete google-places-api


【解决方案1】:

默认情况下,Google Places API 更喜欢显示您的搜索范围内的结果,但可以返回范围外的结果。该 API 还支持一个名为 strictbounds 的参数,该参数会将结果限制在您的搜索范围内。

更多信息可以在here找到。

【讨论】:

  • 知道如何将 iOS SDK 用于strictbounds 参数吗?
猜你喜欢
  • 1970-01-01
  • 2015-07-28
  • 1970-01-01
  • 2016-10-28
  • 2022-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多