const vector = new VectorSource();
const vectorLayer = new VectorLayer({
declutter: "separate", //true false separate
source: vector,
properties: { title: `base-vector`, id: 'v01' },
style: new Style({
fill: new Fill({
color: 'rgba(249, 231, 159 , 0.2)',
}),
stroke: new Stroke({
color: '#ffcc33',
width: 2,
}),
image: new CircleStyle({
radius: 7,
fill: new Fill({
color: 'rgba(2231, 76, 60 , 0.5)',
}),
stroke: new Stroke({
color: '#ffcc33',
width: 2,
}),
}),
}),
zIndex: 40,
visible: true,
});
主要是属性declutter
,用于处理矢量图层上重叠的标注和符号,为true时启用去重叠功能。所有矢量特征的标注和符号都会被处理以避免重叠。false则与之相反。separate将标注和符号分别处理,避免它们之间的相互覆盖。