【问题标题】:Google places: Use multiple typesGoogle 地方:使用多种类型
【发布时间】:2018-07-25 08:55:48
【问题描述】:

这个问题是对一些过时问题的更新:


因为我需要一种方法可以让所有人都靠近餐厅商店教堂,我认为 Google Places API 似乎可以满足我的需求,但我在过滤时遇到了一些问题:我想在一个请求中搜索多个 places-types

let url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?"
url += "location=" + 79.999 + "," + 8.999
url += "radius=" + 2000
url += "type=" + mytype// ??
url += "key=" + mykey

这就是我的网址应该的样子。但是我在设置多种类型时遇到了麻烦,例如:

mytype 设置为“餐厅”可能工作得很好。

mytype 设置为“restaurant,store,church”无效。

mytype 设置为“[restaurant,store,church]”也不起作用。


我知道搜索多种地点类型的功能很久以前就被 Google 禁用了。但是使用 javascript API 可以很好地处理多种类型,因此 URL 请求可能也应该以这种方式工作。

【问题讨论】:

    标签: javascript swift google-maps google-maps-api-3


    【解决方案1】:

    在 Google 地方信息中无法使用多种类型

    https://developers.google.com/places/web-service/search

    通过上面的链接:

    在“附近搜索请求”部分下,您会找到答案。

    【讨论】:

    • 感谢您的回答。链接有助于为答案提供支持文档。但请在任何答案中包含实际答案。
    【解决方案2】:

    "|" 分隔类型就可以了。

    let mytype = "restaurant|food|store"
    let url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?"
    url += "location=" + 79.999 + "," + 8.999
    url += "radius=" + 2000
    url += "type=" + mytype// ??
    url += "key=" + mykey
    

    Volià,希望我能帮上忙。

    【讨论】:

      猜你喜欢
      • 2016-08-25
      • 2016-10-07
      • 2015-10-15
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 1970-01-01
      • 2015-01-08
      • 2023-04-07
      相关资源
      最近更新 更多