我是一个 javascript 菜鸟,所以请帮帮我!
我做了一个包含几个城市的数组:
var cities = [
['City 1', 59.326294118560725, 17.98754555000005],
['City 2', 57.70231523439743, 11.893682500000068],
['City 3', 62.39591678065696, 17.292328450000014],
['City 4', 59.89396160257896, 10.785116549999998],
['City 5', 57.10938174202619, 12.25817589999997]
];
我希望能够按名称选择两个或更多城市并在它们之间画一条线。
我找到了这段代码:
var route = new google.maps.Polyline({
path: something
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
map: map
});
如何修改它以便我可以从数组中选择一两个城市,并使用城市名称作为参考?