大家好,我需要将折线置于地图中心。
以下是核心代码...
success: function(data) {//callback to be executed when the response has been received
data = JSON.parse(data);
for (var i=0;i<data.length;i++) {
flightPlanCoordinates[i] = new google.maps.LatLng(data[i].x,data[i].y);
}
map = new google.maps.Map(document.getElementById("map_find"),
mapOptions);
flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
strokeColor: "#8a2be2",
strokeOpacity: 1.0,
strokeWeight: 3
});
flightPath.setMap(map);
map.setZoom(5);
map.setCenter(flightPlanCoordinates);
}
这不是我所需要的...我的地图没有居中并且没有缩放,如何实现?
flightPath.setMap(map);
之前调用它吗? - user123_456