Google 地图:Google Places JS API:getDetails() 未返回整个地点详细信息

Google Maps: Google Places JS API: getDetails() not returning entire place details

我正在尝试在地图上显示 2 个位置,单击它们会在各自的信息窗口中显示所有地点详细信息。我只能得到 return 个非常有限的地方详细信息来显示,即地址,仅此而已。你可以在这里看到:http://www.intermountainvet.com/contact-0。我正在控制台记录地点对象。

我知道这个业务有一个强大的 google 地方,你可以在这里看到:https://www.google.com/maps/place/Intermountain+Pet+Hospital+%26+Lodge/@43.5906437,-116.4033528,15z/data=!4m6!1m3!3m2!1s0x0:0x2a5e055f442189ea!2sIntermountain+Pet+Hospital+%26+Lodge!3m1!1s0x0:0x2a5e055f442189ea

为什么我无法访问所有这些地点的详细信息以显示在我的信息窗口中?

这是我的代码。 (我有我的 api 密钥和 libraries=places src 在我没有在这里显示的脚本标签中):

<script type="text/javascript">
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 43.618928, lng: -116.274319},
zoom: 11
});

var infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);

var locA = service.getDetails({
placeId: 'ChIJa_maRXxRrlQRSimVL1yUG8Q'
}, function(place, status) {
  console.log(place);
  console.log(status);
if (status === google.maps.places.PlacesServiceStatus.OK) {
  var marker = new google.maps.Marker({
    map: map,
    position: place.geometry.location
  });

  google.maps.event.addListener(marker, 'click', function() {
    infowindow.setContent('<img src="' + place.icon + '" /><font style="color:#000;">' + place.name +
    '<br />Rating: ' + place.rating + '<br />Vicinity: ' + place.vicinity + '</font>');
    infowindow.open(map, this);
  });
}
});

var locB = service.getDetails({
  placeId: 'ChIJow1xfMRUrlQR6ewuO4NvrF0'
}, function(place, status) {
  console.log(place);
  console.log(status);
  if (status === google.maps.places.PlacesServiceStatus.OK) {
    var marker = new google.maps.Marker({
        map: map,
        position: place.geometry.location
    });
    google.maps.event.addListener(marker, 'click', function() {
        infowindow.setContent('<img src="' + place.icon + '" />font style="color:#000;">' + place.name +
        '<br />Rating: ' + place.rating + '<br />Vicinity: ' + place.vicinity + '</font>');
        infowindow.open(map, this);
    });
    }
});


}

感谢观看。我觉得这应该很简单,我一定是遗漏了一些小东西。

您需要使用商家的地点 ID (ChIJa_maRXxRrlQR6okhRF8FXio) 而不是地址 (ChIJa_maRXxRrlQRSimVL1yUG8Q)