如何在逻辑上划分为段的地图上显示标记(巨大数字)? [英] How to display markers (huge numbers) on a map which has been logically divided into segments?

查看:208
本文介绍了如何在逻辑上划分为段的地图上显示标记(巨大数字)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在开发一个应用程序,我必须在Navteq地图上显示多于(50K)个点/标记,并将其划分为不同的细分。
例如:如果我有50K点,我会将所有点分成不同的部分。



如果我将 50K 点分成 50 分段,每个分段将有 1000 点(可能不是50个分段,可能取决于) 。
现在它正在工作,但它需要很长时间并挂起以呈现MAP上的所有点。因此,我想执行分段显示以仅显示聚类的几个点。
,这样我就可以知道细分受众群的样子。



但问题在于我应该只根据细分受众群进行聚类。否则来自不同细分市场的积分将会混合在一起,并显示
作为单个单位,并将错误信息传达给用户。

所以在这里我的问题是:是否可以根据分段执行聚类。所以只有来自同一细分市场的点才会聚集在一起。



注意:如果这不可行,我想使用最新版 here-maps 2.5.3 (Asynchronous)可能会在加载时减少一些时间,因此我希望在渲染点
的同时使用索引功能来改善渲染使用 诺基亚.maps.clustering.Index class。



我研究过索引会减少时间,同时在地图上绘制点/标记。它对我的情况有帮助吗?任何人都可以建议如何执行索引?



这是我在地图上显示点的代码:

 函数displayAllLightPoints(arrLightPointCoordinats,totalLightPoints,
selectedSegmentId,totalSegmentsCount,segmentColorcode)
{
var MyTheme1 = function ){
};
segmentColorcode = segmentColorcode.substring(2,segmentColorcode.length-1);

MyTheme1.prototype.getNoisePresentation = function(dataPoint){
var markerLightPoint = new nokia.maps.map.Marker(dataPoint,{
icon:new nokia.maps.gfx .BitmapImage(..// Images // Lightpoint //+
segmentColorcode +.png),
anchor:{
x:12,
y:12
}
});
return markerLightPoint;
};

MyTheme1.prototype.getClusterPresentation = function(data){
var markerLightPoint = new
nokia.maps.map.StandardMarker(data.getBounds()。getCenter(),{
icon:new nokia.maps.gfx.BitmapImage(..// Images //
Segment /+ segmentColorcode +.png,null,66,65),
text :data.getSize(),
zIndex:2,
anchor:{
x:12,
y:12
}
});
return markerLightPoint;
};

var ClusterProvider = nokia.maps.clustering.ClusterProvider,
theme = new MyTheme1(),
clusterProvider = new ClusterProvider(map,{
eps:0.00000000001,
minPts:1000000,
策略:nokia.maps.clustering.ClusterProvider。
STRATEGY_DENSITY_BASED,
主题:主题,
dataPoints:[]
}) ;
var lightpointsDataSet1 = new Array();
for(var i = 0; i< totalLightPoints; i ++){
lightpointsDataSet1 [i] = {latitude:arrLightPointCoordinats [i] [0],
longitude:arrLightPointCoordinats [i] [ 1],标题:
'LightPoint'+(i + 1)};
}

clusterProvider.addAll(lightpointsDataSet1);
clusterProvider.cluster();
}


解决方案

(50K +)数据集,我会做所有繁重的数据处理服务器端并在映射更新时发送新的JSON响应。类似于此处描述的HTML页面



代码的关键部分是ZoomObserver:

$ p $ var zoomObserver = function(obj,key,newValue, oldValue){
zoom = newValue;如果(zoom< 7)
{zoom = 7;}
if(zoom> 16)
{zoom = 16;}
//定义读取包含标记数据的XML文件名
placeMarkersOnMaps('http://api.maps.nokia.com/downloads/java-me/cluster/'+ zoom +'.xml'
+' ?lat1 ='+ map.getViewBounds()。topLeft.latitude
+'& lng1 ='+ map.getViewBounds()。topLeft.longitude
+'& lat2 ='+ map.getViewBounds ().bottomRight.latitude
+'& lng2 ='+ map.getViewBounds()。bottomRight.longitude);
};

map.addObserver(zoomLevel,zoomObserver);

如果REST服务返回可用于添加标记的知名数据格式,集群到地图上。



现在假设您有两个海量数据集,您可以向不同端点发出两个请求,或者以某种方式区分哪个数据属于哪个,以便您只需返回表单的信息:

  {latitude':51.761,'longitude': 14.33128,'value':102091},

即使用 DataPoint 标准(这意味着你也可以使用热图)。

当然,我没有在这里展示的是后台集群功能 - 但是这会让客户端(和API)尽其所能显示数据,而不是数字运算。


What i have done so far: i'm developing an application where i have to display more than(50K) points/Markers on the Navteq map divided into different segments. for example: if i have 50K points i will divide all points into different segments.

if i divide 50K points into 50 segments each segment would have 1000 points (may not be 50 segments , it may depend). right now it is working but it takes long time and hangs to render all the points on the MAP.so that i would like to perform segmentation displaying to display only few points with clustering. so that i can get an idea of how the segment will look like.

but the problem here is i should only perform the clustering based on the segments.otherwise points from different segments willbe mixed together and displayed as single unit and that conveys the wrong information to the user.

so here my question is: is it possible to perform the clustering based on the segment. so that only points from same segment will be clustered.

Note: if this is not possible, i would like to use Latest version of here-maps 2.5.3 (Asynchronous) may reduce some time while loading, so that i would like to use indexing functionality also while rendering the points to improve the rendering time using nokia.maps.clustering.Index class.

i studied that indexing would reduce the time while rendering the points/markers on map. does it help in my case? could anybody please suggest how to perform indexing ?

This is the code with which i'm displaying points on map:

function displayAllLightPoints(arrLightPointCoordinats, totalLightPoints, 
                    selectedSegmentId, totalSegmentsCount,segmentColorcode) 
{
    var MyTheme1 = function () {   
    };
    segmentColorcode = segmentColorcode.substring(2,segmentColorcode.length-1);

    MyTheme1.prototype.getNoisePresentation = function (dataPoint) {
            var markerLightPoint = new nokia.maps.map.Marker(dataPoint, {
            icon: new nokia.maps.gfx.BitmapImage("..//Images//Lightpoint//" + 
                                                  segmentColorcode + ".png"),
            anchor: {
                x: 12,
                y: 12
            }
        });
        return markerLightPoint;     
    };

    MyTheme1.prototype.getClusterPresentation = function (data) {   
        var markerLightPoint = new 
            nokia.maps.map.StandardMarker(data.getBounds().getCenter(), {
            icon: new nokia.maps.gfx.BitmapImage("..//Images//
                Segment/" + segmentColorcode + ".png", null, 66, 65),
            text: data.getSize(),
            zIndex: 2,
            anchor: {
                x: 12,
                y: 12
            }
        });
        return markerLightPoint; 
    };

    var ClusterProvider = nokia.maps.clustering.ClusterProvider,
        theme = new MyTheme1(),
        clusterProvider = new ClusterProvider(map, {
            eps: 0.00000000001,
            minPts: 1000000,
            strategy: nokia.maps.clustering.ClusterProvider.
                                     STRATEGY_DENSITY_BASED,
            theme: theme,
            dataPoints: []
        });
    var lightpointsDataSet1 = new Array();
    for (var i = 0; i < totalLightPoints; i++) {     
        lightpointsDataSet1[i] = { latitude: arrLightPointCoordinats[i][0], 
             longitude: arrLightPointCoordinats[i][1], title:
            'LightPoint ' + (i + 1) };
    }

    clusterProvider.addAll(lightpointsDataSet1);
    clusterProvider.cluster();
}

解决方案

To deal with a very large (50K+) data set , I would do all the heavy number crunching server side and send over a new JSON response whenever the map is updated. Something like the HTML page described here

The key section of the code is the ZoomObserver:

var zoomObserver = function (obj, key, newValue, oldValue) {
  zoom = newValue;
  if (zoom < 7)
    { zoom = 7;}
  if (zoom > 16)
    { zoom = 16;}
  // Define the XML filename to read that contains the marker data
  placeMarkersOnMaps('http://api.maps.nokia.com/downloads/java-me/cluster/'+ zoom + '.xml' 
    + '?lat1=' + map.getViewBounds().topLeft.latitude
    + '&lng1='+ map.getViewBounds().topLeft.longitude
    + '&lat2='+ map.getViewBounds().bottomRight.latitude
    + '&lng2='+ map.getViewBounds().bottomRight.longitude);
};

map.addObserver("zoomLevel", zoomObserver );

Where the REST service returns a "well-known" data format which can be used to add markers and clusters to the map.

Now assuming you have two massive data sets you could make two requests to different endpoints, or somehow distinguish which cluster of data belongs to which so that you would just be returning information of the form:

{latitude':51.761,'longitude':14.33128,'value':102091},

i.e. using the DataPoint standard (which means you could use a heat map as well.

Of course, what I'm not showing here is the back-end functionality to cluster in the first place - but this leaves the client (and the API) to do what it does best displaying data, not number crunching.

这篇关于如何在逻辑上划分为段的地图上显示标记(巨大数字)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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