ThinkGeo.com    |     Documentation    |     Premium Support

What is best and stable stratey to refresh markers (InMemoryMarkerOverlay)?

Hi ThinkGeo,


What is best and stable stratey to refresh markers (InMemoryMarkerOverlay)?  I have about 2-4 InMemoryMarkerOverlay and 1 InMemoryFeatyureOverlay.


Options:


1) Should I use Timer in Update panel + JavaScript callback associated to a C#Callback method?


2) Should I use  AutoRefreshInterval handler on one of the markeroverlay?

Regards,


Anil




Hi Anil, 
  
 Technically, I prefer the second one. It will consume less memory on the server, because it refreshes the overlays using client timer and communicate with Callback. But the UpdatePanel and Ajax timer will use the server side resources. 
  
 Thanks, 
 Johnny 
   


Hi Johnny, 
  
 Thanks. The strategy works much better than 1.  
 Is there a way to reset the timer for AutoRefreshInternal during the time the callback function is running ? 
  
 I am thinking of setting the Interval to high value and then reset back after the callback method completes. 
  
 Regards, 
 Anil

Hi Anil,


It can be managed by overwriting the refresh code which looks like below:

    <script language="javascript" type="text/javascript">
        OnMapCreating = function (map) {
            OnMapRefresh = function (map) {
                for (var i in map.layers) {
                    var layer = map.layers;
                    var UpdateInterval = layer.autoRefreshMilliseconds;
                    var tick = layer.tick;
                    if (tick && UpdateInterval && UpdateInterval != 0) {
                        var timer = window.setInterval(Function.createDelegate({ 'args': 'AutoRefresh', 'id': layer.id }, function (evt) {
                            var args = this.args + "_" + this.id;
                            eval("CallServerMethod" + map.clientId + "(args, map.clientId)");
                        }), UpdateInterval);
                    }
                }
            }
        }
    </script>


Thanks,
Johnny