我正在尝试使用多边形在 google maps api v3 上构建路线。我已经预定义了需要允许编辑的路线。问题是我预定义的折线没有显示在地图上。我在这里想念什么?
var drawingManager = new google.maps.drawing.DrawingManager({
drawingMode: google.maps.drawing.OverlayType.ROADMAP,
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [
google.maps.drawing.OverlayType.POLYLINE
]
},
polylineOptions: {
strokeColor: '#ff0000',
strokeOpacity: 1,
strokeWeight: 3,
zIndex: 1,
editable: true,
path: [
new google.maps.LatLng(37.772323, -122.214897),
new google.maps.LatLng(21.291982, -157.821856),
new google.maps.LatLng(-18.142599, 178.431),
new google.maps.LatLng(-27.46758, 153.027892)
],
visible: true
}
});
drawingManager.setMap(map);