// 创建 一条线
const polyline = new Feature(new LineString([
fromLonLat([117.227239, 31.820586]),
fromLonLat([117.327239, 31.820586]),
fromLonLat([117.327239, 31.920586])
]))
polyline.setStyle(
new Style({
stroke: new Stroke({
width: 2, // 线宽
color: '#f00' // 线颜色
// 虚线
// lineCap: 'round',
// lineDash: [40, 8]
// lineDashOffset: 4
})
})
)
// 创建 多条线
const polyline = new Feature(new MultiLineString([
[
fromLonLat([0, 0]),
fromLonLat([18, 60])
],
[
fromLonLat([18, 60]),
fromLonLat([9, 30])
]
]))
polyline.setStyle(
new Style({
stroke: new Stroke({
width: 2, // 线宽
color: '#f00' // 线颜色
// 虚线
// lineCap: 'round',
// lineDash: [40, 8]
// lineDashOffset: 4
})
})
)
07-07
4315
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-16