【发布时间】:2020-02-01 16:36:49
【问题描述】:
我正在使用 zeppelin 和 Angular 解释器。 我尝试了三种不同的方法。他们都没有成功。但是出现了简单的标记。
第一个
var array = [];
all_properties.forEach(item =>{
array.push(new L.LatLng(item[0], item[1]));
});
var firstpolyline = new L.polyline(array, {
color: 'red',
weight: 5,
opacity: 1,
smoothFactor: 1
});
firstpolyline.addTo(map);
第二个
var poly = new L.polyline(all_properties, {
color: 'green',
weight: 5,
opacity: 1,
smoothFactor: 1
});
poly.addTo(map);
第三个
var polylinePoints = [
[lat, long],
[lat1, long1]
];
var polyline = L.polyline(polylinePoints).addTo(map);
没有错误...
有什么想法吗?谢谢
编辑:当我将点显示为标记时,它们都显示在地图上。这组标记应该是折线...
arr_markers = [];
all_properties.forEach(item =>{
arr_markers.push(L.marker([ item[0], item[1]], {icon: basicIcon}));
});
polyGroup = L.layerGroup(arr_markers).addTo(map);
【问题讨论】:
-
你的
all_properties看起来怎么样? -
哦,是的,它是一个字段 [[0,1],[0,1],...] - 这就是我 forEach 然后访问索引 0、1 的原因
标签: javascript angular leaflet apache-zeppelin polyline