2014-03-06 17 views
0

我到目前爲止做了什麼: 我正在開發一個應用程序,我必須在Navteq地圖上顯示多於(50K)個點/標記,並將其劃分爲不同的部分。例如:如果我有50K點,我會將所有點分成不同的部分。如何在已被邏輯地劃分成段的地圖上顯示標記(巨大數字)?

如果我將50K分爲50分段,每個分段將有1000分(可能不是50分段,可能取決於)。 現在它正在工作,但它需要很長時間,並且呈現MAP.so上的所有點,所以我想執行分段顯示以僅顯示聚類的幾個點。 ,以便我可以瞭解細分受衆羣的外觀。

但這裏的問題是我應該只執行基於片段的聚類。另外來自不同片段的點將被混合在一起並顯示爲單個單元,並向用戶傳達錯誤的信息。

所以這裏我的問題是:是否有可能執行基於段的聚類。這樣只有來自同一細分市場的點纔會聚集在一起。

注:如果這是不可能的,我想用最新版本here-maps 2.5.3(異步)可能會降低一些時間,同時加載,這樣我想用索引功能也同時呈現點 改善渲染時間使用nokia.maps.clustering.Index類。

我研究過索引會減少時間,同時在地圖上渲染點/標記。它對我的情況有幫助嗎?任何人都可以建議如何執行索引?

這是與我在地圖上顯示點代碼:

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(); 
} 

回答

2

處理一個非常大(50K +)數據集,我會做所有繁重的數字運算服務器端每當地圖更新時發送新的JSON響應。像HTML頁面的東西描述here

代碼的關鍵部分是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); 

凡REST服務返回其可用於添加標記和簇「公知」的數據格式到地圖。

現在,假設你有大量數據集,你也可以創建兩個請求不同的端點,或以某種方式區分哪些數據的簇屬於哪個讓你也只是迴歸的形式的信息:

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

即使用DataPoint標準(這意味着你可以使用熱圖以及

當然,我不是在這裏展示的是後端功能擺在首位集羣 - 但這離開客戶端(和API)做它的工作es最好顯示數據,而不是數字處理。

相關問題