Raja,
I agree that SimpleMakerOverlay will run into performance issue with huge markers with huge Popup information. But I think many ways we can manage to improve it:
1. We just set the basic information for the maker without any popup information on server side, such as position, icon image etc. In this way, we can decrease the size transported between client and server side.
To get the popup information, we can add a httphandler to get the information based on marker’s id from client side AJAX request.
2. The SimpleMarkerOverlay loads all the markers from server side for the first time. To make sure it always loads the markers in current viewing area, we can overwrite the client method “SendMarkerRequest” to make sure it works fine for SimpleMarkerOverlay’s AJAX request. Here is the sample code:
[code]
<script language="javascript" type="text/javascript">
var OnMapCreating = function(map) {
var mapParser = Map1.GetMapParser();
mapParser.sendMarkersRequest = function() {
for (var i = 0; i < this.simpleMarkerOverlayIds.length; i++) {
var markerOverlayId = this.simpleMarkerOverlayIds[i];
var overlay = this.map.getLayer(markerOverlayId);
var url = this.getMarkerRequestUrl(markerOverlayId, 0);
if (url) {
CurrentMapClientId = this.map.clientId;
var httpRequest = new OpenLayers.Ajax.Request(url, { 'method': 'get', 'onComplete': function(transport) {
if (transport.status == 200) {
var map = eval('parser' + CurrentMapClientId + '.map');
AddMarkersByAjax(map, transport.responseText);
}
}
});
}
}
},
mapParser.getMarkerRequestUrl = function(markerOverlayId, gridSize) {
var url = null;
if (this.simpleMarkerOverlayIds.length != 0) {
url = 'markers_GeoResource.axd?';
url += 'overlayIds=' + markerOverlayId;
url += '&extent=' + ConvertBoundsToString(this.map.getExtent());
url += '&level=' + (parseInt(this.map.getZoom()) + 1);
url += '&pageName=' + this.pageName;
url += '&clientId=' + this.json.cid;
url += '&scale=' + this.map.getScale();
url += '&gridSize=' + gridSize;
url += '&extra=' + Math.random().toString();
}
return url;
},
mapParser.createMap = function() {
this.onMapCreating(this.map);
this.initOverlays(this.json);
this.initBaseOverlay(this.json.baselayerid);
this.initExtent(this.json);
// this.addSimpleMarkers();
this.initPopups(this.json);
this.initControls(this.json);
this.initHighlightOverlay(this.json.highlightOverlay);
this.initEditOverlay(this.json.editOverlay);
this.initMapMode();
this.initMeasureMode();
this.registerChangeBaseLayerEvent(this.json);
this.releasePageLoad();
this.onMapCreated(this.map);
this.onMapRefresh(this.map);
this.map.panByPopup = false;
}
</script>
</Code>
3. Besides the ways above, we also can add the cluster strategy for the SimpleMarkerOverlay based on screen distance between each other.
The above are the ways we can try to improve the SimpleMarkerOverlay performance. Any questions please let us know.
Thanks,
Johnny