Canvas 用declut标记DECLUTER圆
我使用openLayers在地图上显示数千个圆圈。然而,当显示所有的点时,它会变得有点让人眼花缭乱。为了对此有所帮助,我在矢量层中添加了declutter选项:Canvas 用declut标记DECLUTER圆,canvas,openlayers,Canvas,Openlayers,我使用openLayers在地图上显示数千个圆圈。然而,当显示所有的点时,它会变得有点让人眼花缭乱。为了对此有所帮助,我在矢量层中添加了declutter选项: const allPointLayer = new VectorLayer({ source: pointSource, visibility: true, style: scanLocationStyle, extent: this.ext
const allPointLayer = new VectorLayer({
source: pointSource,
visibility: true,
style: scanLocationStyle,
extent: this.extent,
declutter: true,
});
这有点帮助,因为它会动态更改正在渲染的显示圆
但现在我想在圆圈中添加一些文字,以表示有多少圆圈被“总结”
我确实发现在ol/render/canvas模块中有DeclutterGroups,但是没有明显的方法来编辑该组的文本或查找数组的大小。以下是其他相关代码段:
map = new Map({
target: "map",
view: new View({
center: getCenter(this.extent),
zoom: 15,
}),
});
const pointSource = new VectorSource({
features: Collection,
format: new GeoJSON(),
style: scanLocationStyle,
});
const style = new Style({
image: circleStyle,
});
const allPointLayer = new VectorLayer({
source: pointSource,
visibility: true,
style: style,
extent: this.extent,
declutter: true,
});
我添加了一些图片来帮助您
谢谢你的帮助!
您是否考虑过使用群集源而不是分离器?不我没有考虑过这一点。但是快速看了一下,它看起来正是我想要的。谢谢你,迈克!您是否考虑过使用集群源而不是declutter?不我没有考虑过这一点。但是快速看了一下,它看起来正是我想要的。谢谢你,迈克!