按关键字过滤 Google 地点 API 结果

Filtering Google Places API results by keyword

本文关键字:API 结果 地点 Google 关键字 过滤      更新时间:2023-09-26

我想按关键字过滤 Google Places API 结果。它目前支持"健身房"类型,但我想更具体地获得"瑜伽"或"拳击"。如何在代码中实现这一点?

function search() {
  var search = {
    bounds: map.getBounds(),
    types: ['gym']
  };

    </script>
    <script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&signed_in=true&libraries=places&callback=initMap"
        async defer></script>

地点类型不能像你想要的那样深入/定义。

将特定术语添加为keyword(假设这是一个附近搜索请求,对于文本搜索,请将其添加到query):

var search = {
  keyword: 'boxing',
  bounds: map.getBounds(),
  types: ['gym']
};