[OpenLayers-Users] Marker Problem when having too much data : Help

sjonnala sj3670 at att.com
Tue Jul 19 17:19:39 EDT 2011


My Code:


var Tower = {

    dofindProperties:function(evt)
    {	
        var bounds = map.getExtent();
        var strBounds = bounds.toBBOX();
        var rectArray = strBounds.split(',');
        
	var rect = 'x1=' +
rectArray[0]+'&y1='+rectArray[1]+'&x2='+rectArray[2]+'&y2='+rectArray[3];
	var zoomLevel = map.getZoom();	
	
	if ( zoomLevel > 12 ) {	
	var url = 'http://q5csp1w2.tdc.cingular.net:7301/TowerTileServer/getTower?'
+ rect +  '&MITile.rest';		
 	new OpenLayers.Ajax.Request(url, 
		    {  method: 'get',
		       onSuccess: Tower.ProcessTowerResults,
		       onError: Tower.endProcessing
		    }   
		);		
	}
		
    },

    *ProcessTowerResults:function(resp)
    {
        var dataStr, longitude, latitude, point;
        var jsonResp = resp.responseText;          
        var respJSONObject = eval('(' + jsonResp + ')'); 
//alert("respJSONObject : "+respJSONObject.length);
	    var tmp;
        var distToFaultStr;
	    for ( var i=0; i < respJSONObject.LBSResponse.towerList.toString();i++)
{
		     var dataStr = '<table>';		
		     dataStr += '<tr><td>' +
respJSONObject.LBSResponse.towerList[i].siteName + '</td></tr>';
             dataStr += '<tr><td>' +
respJSONObject.LBSResponse.towerList[i].techName + '</td></tr>';
             dataStr += '<tr><td>' +
respJSONObject.LBSResponse.towerList[i].siteStatus + '</td></tr>';
             dataStr += '</table>';		

	    	longitude = respJSONObject.LBSResponse.towerList[i].point.x;
        	latitude = respJSONObject.LBSResponse.towerList[i].point.y;
                
        	point = new OpenLayers.LonLat(longitude, latitude);            	    	
	    	var icon;
 	    	var size = new OpenLayers.Size(14,13);
        	var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
	    	icon = new OpenLayers.Icon('Images/tower_blue.gif',size,offset);
        	Tower.AddMarker(point, dataStr, icon);
		}
    }, *

    AddMarker:function(pt, dataStr, icon)
    {
        var data = new Object();
        
        data.icon = icon.clone();
        data['popupContentHTML'] = dataStr;
        data['latlon'] = pt;

        var feature = new OpenLayers.Feature(mi_Markers, pt, data);
        var marker = feature.createMarker();
        marker.events.register('click', feature, Tower.markerClick);        
        ti_Markers.addMarker(marker);
    },    
  
    markerClick: function(evt) {
        sameMarkerClicked = (this == selectedFeature);
        selectedFeature = (!sameMarkerClicked) ? this : null;
        
        for(var i=0; i < ti_Markers.map.popups.length; i++) {
            ti_Markers.map.removePopup(ti_Markers.map.popups[i]);
        }       
        
        var anchor=(this.marker)?this.marker.icon:null;
        
        popup = new
OpenLayers.Popup1.Anchored("olPopup",this.data.latlon,null,this.data.popupContentHTML,anchor,true)
        
        if (!sameMarkerClicked) {
            ti_Markers.map.addPopup(popup); 
        }
        OpenLayers.Event.stop(evt);
    }
}
    

Here "respJSONObject" length is 13783. With this large amount of data, my IE
browser is simply hanging out with out showing the marker layers. If i make
the loop for less values I'm able to see the icons on the marker layer.
Please help me in getting around this issue.
	

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Marker-Problem-when-having-too-much-data-Help-tp6600371p6600371.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list