2016-04-25 110 views
0

我有一个自定义的Google地图,其中标记是动态填充的,我尝试将标记链接重定向到Google地图上相应的地点详细信息页面。例如,在标记点击上,我想为此链接打开一个新窗口:https://www.google.com/maps/place/PMBCOM/@46.381949,6.236581,17z/data=!3m1!4b1!4m2!3m1!1s0x478c372f7df47135:0xff206d31a973ededGoogle Maps API - 链接到地点详细信息页面

现在,我可以重定向到该地址,但它不显示完整的“Google我的商家”面板,例如我的上一个链接。有任何想法吗 ?

这里是我的代码:

function initMap() { 
    var myLatlng = new google.maps.LatLng(agence[0], agence[1]); 
    var map = new google.maps.Map(document.getElementById('maps'), { 
    center: myLatlng, 
    zoom:17 
}); 

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

service.getDetails({ 
    placeId: 'ChIJ71BChS4ujEcRclm9twk3Y04' 
}, function(place, status) { 
    if (status === google.maps.places.PlacesServiceStatus.OK) { 
     var marker = new google.maps.Marker({ 
     map: map, 
     position: place.geometry.location, 
     title: place.name, 
     url: 'https://www.google.com/maps/place/'+place.formatted_address 
}); 
google.maps.event.addListener(marker, 'click', function() { 
    infowindow.setContent(place.name); 
    infowindow.open(map, this); 
    window.open(marker.url); 
    }); 
} 
}); 
} 
google.maps.event.addDomListener(window, 'load', initMap); 

感谢您的帮助

回答

1

看看这部分

url: 'https://www.google.com/maps/place/'+place.formatted_address 

谷歌无法找到该公司以这种方式

变化

url: place.url 

我觉得这是你想要的

相关问题