javascript - 将 Google map API nearBysearch 与多种类型一起使用

标签 javascript api google-maps search types

所以我在 Javascript 中使用谷歌地图 API,我的搜索代码如下所示:

therequest = {
bounds: map.getBounds(),
type: 'Cafe',
};

service.nearbySearch(therequest, callback);

我想在一次搜索中搜索多种类型,我知道您可以使用:

types: ['Cafe','bar']

但根据谷歌文档,这种方法将在明年年初停止支持。是否有替代方法来实现类似的搜索,或者您是否只需要使用不同的请求循环搜索?

如有任何帮助,我们将不胜感激!

谢谢,

标记

最佳答案

截至目前,我认为 Google 尚未发布该参数的替代方式/替代品。它只在这个 documentation 中说那个,

The implementation for types in text search requests is changing. The types parameter is deprecated as of February 16, 2016, replaced by a new type parameter which only supports one type per search request. Requests using the deprecated features will be supported until February 16, 2017, after which all text searches must use the new implementation.

所以我们还有一年的时间来使用它,也许谷歌可能会像他们在 2014 年 6 月 24 日弃用的 id 和引用字段上所做的那样延长这段时间。他们又延长了一年,因为他们正在寻找方法确保此更改不会破坏现有代码。只是一个意见。

关于javascript - 将 Google map API nearBysearch 与多种类型一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36956018/

相关文章:

javascript - 根据选择设置下拉列表中的显示值

javascript - 我的 fullcalendar 插件中的弃用警告

java - Spring boot - WeatherApp - API

java - 如果我有自己的日历 API,如何指向下一个工作日

java - 如何设置 RTC 工作项的 "Found In"属性值?

jquery - 使用 fancybox 时谷歌地图在新窗口中显示图像的问题

javascript - 原始 HTML 上的正则表达式

javascript - history.listen 未在 componentDidMount 中触发

android - 从 Activity 添加标记到 fragment 映射

javascript - 如何将 JQuery 变量传递给全局变量