是否可以从 Google 地方信息接口响应中排除某些"类型"?



我有一个旅游网站,列出了每个城市的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

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

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

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

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

位置 API 搜索有以下终结点:

  • 附近的搜索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

相关内容

最新更新