1
我希望能够在我的站点的所有多段线上放大缩放。fitbounds for google maps api v3不以我的多段线为中心
此外,我想添加标记到每个这些新的坐标对。我见过很多的多个标记和多个plygons例子,但绝不是折线,我不能左右这个问题得到...
我已经看到了一些非常有用的网页像这样的:http://salman-w.blogspot.com/2009/03/zoom-to-fit-all-markers-polylines-or.html
但是,他们大多数都预先假定了某种知识,而我不太了解。
这是我的代码:
<script type="text/javascript">
function initialize() {
var myLatLng = new google.maps.LatLng(45.397, 5.644);
var centerLatLng = new google.maps.LatLng(35.71,-1.905);
var myOptions = {
zoom: 5,
center: centerLatLng,
scrollwheel: false,
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var flightPlanCoordinates = [
new google.maps.LatLng(45.397, 5.644),
new google.maps.LatLng(28.713383,-17.905781),
new google.maps.LatLng(20.713383,-19.905781),
new google.maps.LatLng(25.713383,-29.905781),
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
strokeColor: "#dddd00",
strokeOpacity: 1.0,
strokeWeight: 3
});
flightPath.setMap(map);
}
</script>
在此先感谢,我很新的网上搜寻API和这个网站。