How can I get Map.setExtent to fire immediately? Deferred problem??

1239
0
01-14-2017 06:36 PM
RiverTaig1
Occasional Contributor

I have a custom SOE which returns a large JSON. Part of the JSON string is the extent that I will ultimately need to zoom to. The main guts of the JSON (the "results" section) takes several seconds to process and is unrelated to the "extentToZoomTo" section.   Because I have rather complex symbology and am not using a cached image service, map.setExtent also takes a few seconds to complete.  What I would like to do is to call map.setExtent immediately after I get the JSON, and then while the server is busy doing that, the client code can work on the "results".  How can I make that happen??  What I have found is that if I simply call map.setExtent before I start processing the "results" section, it doesn't actually send that request to the server until after the results have been completely processed.  I can verify that behavior by inspecting the Network tab in the developer tools. I'm guessing that this has something to do with the fact that setExtent is deferred.  How can I get it to fire right away?  If it matters, I have ArcGIS Server 10.2.  

{
  "extentToZoomTo": {
    "xmin": 1234,
    "ymin": 4567,
    "xmax": 2345,
    "ymax": 5678
  },
  "results": {
          //A very large amount of data here that takes several seconds to process
  }
}

Tags (2)
0 Kudos
0 Replies