【问题标题】:Google Places Api rankby=distance not working [duplicate]Google Places Api rankby =距离不起作用[重复]
【发布时间】:2018-03-19 08:15:30
【问题描述】:

我正在使用 Google places api 仅获取离我的位置最近的一些地点,但有些结果根本没有显示(例如 tbilisimarriot 和 courtbymarriot 结果),而且列表也没有正确显示从最近到最长的地点。我的请求网址是:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.711586,44.748187&rankby=distance&keyword=(tbilisimarriot)OR(courtyardbymarriot)OR(ambassadori)OR(mercure)OR(ibishotel)OR(holidayinn)OR(cityavenue)OR(hotelcitycenter)OR(museumhotel)OR(hotelastoria)OR(citadelnarikala)OR(iotahotel)OR(preferencehualing)&key=***

我是否错误地使用了网址?什么是问题?谢谢!

【问题讨论】:

  • 我玩过这个,我也想不通。如果我搜索“Marriot”,我可以获得两个 Marriot,但如果我搜索“Marriot|Mercure”,第一个 Marriot 就会消失。对不起:(
  • 恐怕Places API 不支持OR 语法。我没有在任何地方看到它的记录。
  • 我也没有在谷歌文档中看到它,但我进行了搜索,人们使用它。如果没有 OR,我怎样才能更好地获得结果?我正在构建 phonegap 应用程序,我只需要获取一些地方,而不是附近的所有地方

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


【解决方案1】:

rankby — 指定列出结果的顺序。请注意,如果指定了 radius(在上面的必需参数中描述),则不得包含 rankby

如果指定了rankby=distance(在下面的可选参数下描述),则需要keywordnametype 中的一个或多个。

https://stackoverflow.com/a/50817579/8646587

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-21
    相关资源
    最近更新 更多