1
我设法通过扩展getBounds
方法居中多边形路径内的标志:标记在多边形路径
//polyline
google.maps.Polyline.prototype.getBounds = function() {
var bounds = new google.maps.LatLngBounds();
this.getPath().forEach(function(e) {
bounds.extend(e);
});
return bounds;
};
所有我需要做的是这样的:
var marker = new google.maps.Marker({
map: map,
position: flight_path.getBounds().getCenter()
});
现在我想的标志达到10%,25%或95%的路径。
我怎样才能做到这一点?
将这项工作为测地折线呢? – andufo
是的,事实上,因为它使用.spherical。类,它是专为测地线 – duncan
哇...这工作真的很好。谢谢! – andufo