【发布时间】:2013-01-17 12:52:58
【问题描述】:
我可以在谷歌地图中绘制多条折线并设置它们的样式,但我想用不同的颜色为每条折线着色。
目前,我有这个代码:
var DrivePath = [
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),
new google.maps.LatLng(12.97918167, 77.6449),
new google.maps.LatLng(12.97918667, 77.64487167),
new google.maps.LatLng(12.979185, 77.64479167),
new google.maps.LatLng(12.97918333, 77.64476)
];
var PathStyle = new google.maps.Polyline({
path: DrivePath,
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
PathStyle.setMap(map);
有什么方法可以为我正在创建的每条折线添加单独的样式?
【问题讨论】:
-
能否分享绘制多条折线的代码。我已经测试了您的代码,但我只能在地图中看到一行
标签: javascript google-maps-api-3