Google Places JS:完全匹配

时间:2017-04-10 14:00:17

标签: javascript google-places-api

我正在使用Google地方按类型查找附近的地点,例如:

placeService.nearbySearch({
  location: {
    lat: lat,
    lng: lng
  },
  radius: radius,
  type: 'hospital'
});

此查询还返回我不希望包含在我的结果中的私人诊所。 我尝试使用参数“name”和“hospital”,但没有运气。 如何限制查询仅搜索医院(严格意义)

反应示例(第一个是诊所):

[
  {
    "geometry": {
      "location": {
        "lat": lat,
        "lng": lng
      }
    },
    "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
    "id": "b5999bf0dd4430fb9727d646124786d65d9b3598",
    "name": "Private Clinic",
    "opening_hours": {
      "open_now": true,
      "weekday_text": []
    },
    "place_id": "ChIJddQneTymMRMRv2A_Sl2z6Pk",
    "reference": "CmRSAAAAL92d4D0kBQ6OBL-S7sNok47bUoJrW0fBRpfvfOwQMH6lLY7qYFT6TsCfOonjjM8Ga5McGz10-sxpVNOO_a3llvkUE98ny_xaVPKs46hyQuld_GwqWQQ5FcGc6XMj1_eOEhCQn0JPeNTi8cQHLjnxe3xSGhQAI18uipgHZyx-myoOjCRYMMEfmw",
    "scope": "GOOGLE",
    "types": [
      "hospital",
      "doctor",
      "health",
      "point_of_interest",
      "establishment"
    ],
    "vicinity": "Address",
    "html_attributions": []
  },
  {
    "geometry": {
      "location": {
        "lat": lat,
        "lng": lng
      }
    },
    "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/doctor-71.png",
    "id": "ff2075175d3d83fff78113c06029e8ead3b4b1a5",
    "name": "Hospital",
    "opening_hours": {
      "open_now": true,
      "weekday_text": []
    },
    "place_id": "ChIJHU7OI-ClMRMR4n9sWIPONLw",
    "rating": 3.7,
    "reference": "CmRSAAAA5J6mz42nH9AZX8hkst-Yh8XTLkb6jD54yWoUYTEnL0t47aWnJKTdop4qmRz2pO71OrtVmx_4mRxVQnezzy-uqx--82qKrTHQ0O2rK0BzbItwiHx8aUEp--EqLfEGQDYoEhA4jyOlEAwD2GJjkP21UbzhGhT1Te6iOF0nbcgWgMeZpIfEd1SC0Q",
    "scope": "GOOGLE",
    "types": [
      "hospital",
      "point_of_interest",
      "establishment"
    ],
    "vicinity": "Address",
    "html_attributions": []
  }
]

0 个答案:

没有答案