【问题标题】:Google Places API - How to return nearest locations?Google Places API - 如何返回最近的位置?
【发布时间】:2016-06-26 16:54:04
【问题描述】:

我的应用程序使用 Google Places API Nearby 搜索来获取离用户最近的位置。我指定了在“https://developers.google.com/places/supported_types”上找到的所有可能的类型。

我的搜索查询看起来有点像这样:“https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=myKeyHere&location=%f,%f&rankby=distance&types=accounting|amusement_park|aquarium|art_gallery|atm|bakery|bank|bar|beauty_salon|bicycle_store|book_store|bowling_alley|bus_station|cafe ... university|veterinary_care|zoo”

但到 2017 年 2 月 16 日,types 参数将被弃用并替换为单个类型参数,因此我将无法再检索附近所有可能的位置。

我必须有哪些选择才能做到这一点?

感谢您的宝贵时间。

【问题讨论】:

  • 你还在想2017年2月。我猜你有足够的时间来开发你的应用程序。你可以稍后升级它

标签: objective-c google-places-api


【解决方案1】:

只需省略types 参数。您希望 API 限制为所有类型,这与根本不需要类型限制相同。你使用的是rankby=distance,所以你不需要设置比location更多的参数。

【讨论】:

  • 根据 Google Places API:“如果指定了 rankby=distance(在下面的可选参数中描述),则需要关键字、名称或类型中的一个或多个。”如果我尝试将搜索查询设为“maps.googleapis.com/maps/api/place/nearbysearch/…”,则不会出现任何结果。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-24
  • 1970-01-01
相关资源
最近更新 更多