禁用聚集点的弹出窗口 [英] Disable popups for clustered points

查看:81
本文介绍了禁用聚集点的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个基于地图的服务,其中包含很多(数千个)标记的地方.我决定在集群支持下使用 OpenLayers .

i'm running a map-based service with a lot (few thousands) of marked places. I decided to use OpenLayers with cluster support.

每个点都有它的弹出窗口,其中包含一些基本信息.问题是,当聚集大量点时,这些点(即50个元素)的弹出窗口确实很大,比OpenLayers div大,并且您可以想象-看起来很糟糕.

Each point has it's popup with some basic informations about it. The thing is that when a big amount of points are clustered, the popup for those i.e. 50 elements is really huge, bigger than the OpenLayers div and as you can imagine - it looks terrible.

是否有可能禁用聚集点的弹出窗口?

Is there any possibility to disable popups for clustered points?

预先感谢

推荐答案

在OpenLayers中示例,每次选择功能或群集时都会调用display函数.我猜你也做了类似的事情:

In OpenLayers example, display function is called every time feature or cluster is selected. .I guess you do something similar:

function display(event) {
  //Show popup here      
}

event.feature具有称为cluster的属性,如果它是特征本身,则包含一个特征;如果是集群特征,则包含一组特征.我建议您检查数组的长度,仅在其中具有一项功能时才显示弹出窗口.

event.feature has property called cluster which either contains one feature if it's the feature itself or an array of features if it's a clustered feature. I suggest that you check length of an array and show popup only when you have one feature in it.

这是我看不到您的代码的最好建议:)

That's the best suggestion I can make without seeing your code :)

这篇关于禁用聚集点的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆