我正在尝试在OpenLayers 4中的矢量源中设置点的样式.
我定义了一种风格:
var pStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
width: 6, color: [255, 0, 0, 1]
})
});
Run Code Online (Sandbox Code Playgroud)
并在图层定义中添加了样式
var pLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: [p]
}),
style: pStyle
});
Run Code Online (Sandbox Code Playgroud)
注释样式定义使得该点出现在地图上,所以我假设其余的代码都没问题.但我无法明白地图上的红色.
小提琴:https://codepen.io/fundef/pen/VXKYjP
我哪里错了?