有什么办法可以看到几个地标何时重叠在同一位置上? [英] Is there any way to see when several placemarks superimposed on the same positions?

查看:87
本文介绍了有什么办法可以看到几个地标何时重叠在同一位置上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以看到几个地标何时重叠在同一位置?

Is there any way to see when several placemarks superimposed on the same positions?

如下图所示,Google Earth,我们可以看到它. 谢谢你.

As the figure below, Google Earth, we have a way to see it. Thank you.

推荐答案

是的,您可以发挥自己的想象力并创建自定义群集.参见此 plunker演示,我使用以下函数来创建类似以下的集群:

Yes, you can use your imagination and make a custom cluster. See this plunker demo, I use the following function to create a cluster like:

var displayOverlapping = function(pixel) {

  var f = map.forEachFeatureAtPixel(pixel, function(ft, l) {
      return ft;
  });
  if (f && f.get('type') == 'cluster') {

    if(f.get('expanded') === true) return;

    var geom = f.getGeometry(),
        coord = geom.getCoordinates(),
        px = map.getPixelFromCoordinate(coord),
        extent = [coord[0], coord[1], coord[0], coord[1]],
        ar_features = [];

    sourceFeatures.forEachFeatureInExtent(extent, function(ft){
        if(ft.get('type') == 'click') ar_features.push(ft);
    });
    var angle = (100 / ar_features.length) * 3.6;

    f.set('expanded', true);
    f.setStyle(style_cluster_hover);
    multiLineString.setCoordinates([]);

    ar_features.forEach(function(row, index){
      var angle2 = index * angle,
          px_end = rotate(px[0], px[1], angle2, 30),
          cd_end = map.getCoordinateFromPixel(px_end);

      multiLineString.appendLineString(
          new ol.geom.LineString([coord, cd_end])
      );

      row.setGeometry(new ol.geom.Point(cd_end));
      row.setStyle(style_parada);
    });
  }
};

该功能在pointermove事件上触发.

这篇关于有什么办法可以看到几个地标何时重叠在同一位置上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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