在Openlayers中,我有3个IconFeatures作为点显示在地图上,彼此正对。 Openlayres是否有内置功能,我可以在其中单击附近获得图标列表?甚至是基础Icon对象的列表?还是我必须实现自己的四叉树或相关结构?
抱歉,有一个简单的解决方案。我刚刚开始使用Openlayers,但尚未完成所有示例。通常在上周完成此任务。
[我看到了Icon Symbolizer的示例,但是当我复制代码并自己运行它时,地图被渲染,但是没有显示任何图标,这与https://openlayers.org/en/latest/examples/icon.html处的实时示例不同。我什至发现丢失的data / icon.png文件和
使用[将multi
选项设置为true的Select交互,以获取所有(重叠)功能”。收听select
事件,您将获得一系列功能。
var select = new Select({
multi: true
});
map.addInteraction(select);
select.on('select', function(e) {
console.log (
e.target.getFeatures().getLength() +
' selected features (last operation selected ' + e.selected.length +
' and deselected ' + e.deselected.length + ' features)'
);
});