Select to view content in your preferred language

timeout for Map#addLayers

1060
2
10-08-2013 02:19 PM
JohnCartwright
Deactivated User
Hello All,

I'm looking for a way to set the timeout for the addLayers method on esri.Map, similar to the way in which one sets a timeout on esriRequest.

When I add a list of mapservices to a Map, and one of them is unresponsive, I have to wait for 60 seconds before the layers-add-result event fires.

Can someone please help?

Thanks!

--john
0 Kudos
2 Replies
ManishkumarPatel
Deactivated User
Hello All,

I'm looking for a way to set the timeout for the addLayers method on esri.Map, similar to the way in which one sets a timeout on esriRequest.

When I add a list of mapservices to a Map, and one of them is unresponsive, I have to wait for 60 seconds before the layers-add-result event fires.

Can someone please help?

Thanks!

--john


Hi John,

You can try the below function change the values as required. you can use a conditional check such as while you add layer to map provide a Id to it. and check map.getLayer(Id). if this is not undefined then add another else you can set the timeout.

//Add the layers, after pausing briefly

setTimeout(function()
{    
    console.log("pausing a few seconds");    
    map.addLayers(mapLayers);
},1000);

hope this helps.

Regards,
Manish
0 Kudos
JohnCartwright
Deactivated User
Thanks for your reply Manish.  I don't think though that your suggestion will address my problem.  I'm already checking for the timeout on individual layer, e.g.

setLayerTimeouts: function() {
   //setup timeouts for each layer to load
   this.layerTimeouts = {};
   dojo.forEach(this.mapServices, function(svc) {
      this.layerTimeouts[svc.id] = setTimeout(dojo.partial(this.layerTimeoutHandler, svc), 5000);
   }, this);
},

layerTimeoutHandler: function(mapservice) {
   logger.warn("failed to load layer "+mapservice.id);
   mapservice.suspend();
},


My issue is that if I wish to take advantage of the DeferredList and not have to track the status of the collection myself, I'm subject to the 60 second timeout before the onLayersAddResult event fires.

--john
0 Kudos