7
我想知道如何使用Google Maps Api V3
在polyline
上显示infowindow
?并出现在折线的中间?!如何在Google Maps v3中将polowindow放在折线上?
我想知道如何使用Google Maps Api V3
在polyline
上显示infowindow
?并出现在折线的中间?!如何在Google Maps v3中将polowindow放在折线上?
首先,您需要计算折线的中间/中间位置。这已经在这里讨论和回答了; https://stackoverflow.com/a/9090409/787921
然后你将不得不打开infowindow;
var infowindow = new google.maps.InfoWindow({
content: "infowindow text content"});
infowindow.setPosition(midLatLng);
infowindow.open(map);
在V3的`ÌnfoWindow.position`has
被改为'InfoWindow.setPosition'所以正确的代码是:'信息window.setPosition(midLatLng);'看到这里http://code.google.com/p/gmaps-API的问题/问题/细节?ID = 4733 – tommasop