google-places-api - Google 将 API 放在附近搜索不一致的结果

标签 google-places-api

我发现附近的搜索返回不一致的结果。

有一天我运行了这个查询(转到客户端库)。它返回了我 4 个结果。给定的

keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&location=1.2564%2C103.8189&rankby=distance&type=lodging



https://gist.github.com/haibin/20e01d38c10d4da9275439c549a2db91

我改天运行了这个查询(去客户端库)。它返回了我 5 个结果。给定的

keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&language=en&location=1.2564%2C103.8189&rankby=distance&type=lodging



https://gist.github.com/haibin/b40e4952b7fddace78d6c37a19542a40

我今天运行了这个查询( curl )。它返回了我 1 个结果。给定的

keyword=Resorts%20World%20Sentosa%20Equarius%208%20Sentosa%20Gateway&language=en&location=1.2564%2C103.8189&rankby=distance&type=lodging



https://gist.github.com/haibin/a65a6d03ace05898913e306840307bdb

知道为什么吗?

最佳答案

可能在使用 rankby=distance 时 google 位置 API 中存在错误参数它跳过某些结果或在“有限半径”中搜索

当我用这些参数运行 curl 时

https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=MY_KEY&keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&location=1.2564%2C103.8189&rankby=distance&type=lodging

正如你所说,它只返回一个结果。

但是当我使用半径参数运行时,它会返回更多已接受的结果
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=1.2564,103.8189&type=lodging&keyword=Resorts+World+Sentosa+Equarius+8+Sentosa+Gateway&key=MY_KEY&radius=300

你通过 go lib 获得了更多的结果,因为他们可能在那个或类似的地方修复了它

有关更多信息,您可以查看以下问题:

Google Places API nearby search rankby distance skipping some nearest places

http://www.itgo.me/a/3468386017980994007/google-places-api-nearby-search-rankby-distance-skipping-some-nearest-places

希望这会帮助你。

关于google-places-api - Google 将 API 放在附近搜索不一致的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41651166/

相关文章:

reactjs - Google Places API 自动完成不显示结果

javascript - Google map 地点自动完成功能被 jQuery Mobile 弹出窗口阻止

android - 在两侧以固定距离从 "google map navigation path"画一条线,这样它将在导航路径周围创建类似 View 的框

google-places-api - Google Places Nearby 搜索结果 - 缺少详细数据?

Android:Google Places Autocomplete - 我如何使用它来填充 RecyclerView 而不是下拉菜单?

javascript - 如何从 Google Places 获取一系列地点的坐标,然后在完成所有操作后使用结果?

ios - iOS 的 Places API 未启用

android - 如何调用 setCountry() 到 AutocompleteFilter Google place API?

android - 谷歌地图上传到谷歌播放后不显示

google-places-api - Google Places Search - Next Page Token 返回相同的结果