是否可以从Google Places API回复中排除某些“类型”?

时间:2017-06-13 12:28:43

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

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

1 个答案:

答案 0 :(得分:0)

目前,您无法从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

相关问题