【问题标题】:Is it possible to exclude some 'types' from the Google Places API responses?是否可以从 Google Places API 响应中排除某些“类型”?
【发布时间】:2017-06-13 12:28:43
【问题描述】:

我有一个列出每个城市的 POI 的旅游网站。所以我使用 Google Places API 来返回兴趣点,如下所示:

 https://maps.googleapis.com/maps/api/place/search/json?location=45.8150108,15.981919&radius=10000&types=point_of_interest&hasNextPage=true&nextPage()=true&sensor=false&key=My_Key

但是,除了 POI 之外,它还返回类似这样的其他类型:

  "types": [
    "travel_agency",
    "real_estate_agency",
    "lodging",
    "point_of_interest",
    "establishment"
  ],

这会导致返回酒店和办公室等物品而不仅仅是 POI,有没有办法强制只返回 POI?我尝试使用type 而不是types,但它仍然返回其他types

【问题讨论】:

    标签: python json web-services google-places-api


    【解决方案1】:

    目前您无法从 Places API 搜索中排除某些类型。公共问题跟踪器中有一个功能请求以添加此功能。

    https://issuetracker.google.com/issues/35822993

    您可以对此功能请求加注星标以添加您的投票并订阅更多通知。

    请注意端点https://maps.googleapis.com/maps/api/place/search/json 没有记录。

    Places API searches 有以下端点:

    • 附近搜索https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
    • 雷达搜索https://maps.googleapis.com/maps/api/place/radarsearch/output?parameters
    • 文字搜索https://maps.googleapis.com/maps/api/place/textsearch/output?parameters

    您应该使用其中之一。此外,types 参数已于 2016 年 2 月弃用:

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多