如何在诺基亚此处地图中区分放置在相同坐标处的两个标记 [英] How to distinct two markers placed at the same coordinates in Nokia Here map

查看:109
本文介绍了如何在诺基亚此处地图中区分放置在相同坐标处的两个标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Nokia Here地图中的相同坐标处放置了两个标记.

I have two markers placed at the same coordinates in a Nokia Here map.

问题是我只能在一个标记处访问.另一个在第一个之下.

The problem is I can access only at one marker. The other is below the first one.

为了访问位于相同坐标处的所有标记,是否有其他选择或其他方法来管理这种情况?

Is there any options or something else to manage this case, in order to have access to all markers placed at the same coordinates ?

推荐答案

确保所有标记都单独可见的唯一方法是将重叠的标记放在稍有不同的位置.我发现最好的效果是向下使用聚类功能来缩放15,并添加一组单独的 jittered 标记以缩放16+来显示.

The only way to ensure that all markers are separately visible is to put the overlapping markers at slightly different locations. The best effect I have found is to use the clustering functionality down to zoom 15 and add a separate set of jittered markers to display at zoom 16+.

  /**
   *  This is a H.clustering.ITheme which displays ordinary markers as
   *   noise points
   */
  function SpiderifyTheme() {
    var baseTheme = new H.clustering.DefaultTheme();
    this.getClusterPresentation = function (cluster) {

      var clusterIcon = baseTheme.getClusterPresentation(cluster).getIcon();
          return new H.map.Marker(cluster.getPosition(), {
              icon: clusterIcon,
          min: cluster.getMinZoom(),
          max: cluster.getMaxZoom()
        });

    };
    this.getNoisePresentation = function (noisePoint) {
      return new H.map.Marker(noisePoint.getPosition(), {
          min: noisePoint.getMinZoom()
        });
    };
  }



  // dataPoints is an array of   H.clustering.DataPoint elements
  var len = dataPoints.length + 1;
  var SCATTER = 0.0001;  // When exploding a group this is the size of the ring.
  var group = new H.map.Group();
  var truncate = function(number, places) {
    var shift = Math.pow(10, places);
    return ((number * shift) | 0) / shift;
  };



  //  Ensure that all markers are offset by  a set amount.
  dataPoints.forEach(function (dataPoint, index ) {
    var jitteredPoint = {
        lng: truncate(dataPoint.lng, 3) + SCATTER + (Math.cos(index) * SCATTER),
        lat: truncate(dataPoint.lat, 3) + SCATTER + (Math.sin(index) * SCATTER)
      },
      marker = new H.map.Marker(jitteredPoint, {
        min: 16});  // This needs to be one more than the  max cluster level
    group.addObject(marker);
  });

  var clusteredDataProvider = new H.clustering.Provider(dataPoints, {
    clusteringOptions: {
      eps: 32,
      minWeight: 2
    },
    max : 15,
    theme: new SpiderifyTheme()
  });

  // First add cluster for zooms 1-15
  var clusteringLayer = new H.map.layer.ObjectLayer(clusteredDataProvider);
  map.addLayer(clusteringLayer);
  // Add the group for zooms 16+
  map.addObject(group);

结果看起来像这样-第一幅图像显示了低变焦时的聚簇标记.第二个以高倍缩放显示抖动的标记.您可以更改群集器的eps值以获得其他效果.

The result looks something like this - the first image shows clustered markers at low zoom. The second shows jittered markers at high zoom. You can alter the eps value of the clusterer to get other effects.

这篇关于如何在诺基亚此处地图中区分放置在相同坐标处的两个标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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