<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamic Map requests same image consecutively in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191172#M17633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok guys, just in case anyone else ever has this problem, here is how I solved it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.) I attached an onUpdaetEnd event to my cached map layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.connect(map, "onUpdateEnd", addDynamicLayers);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.) I created a function that checked if this was the initial application load, then added the dynamic maps on top&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function addDynamicLayers() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isFirstRun) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayers([dynamicMapServiceLayer, poiMapServiceLayer]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isFirstRun = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Previously I added all layers at the same time in my init function as follows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.addLayers([cachedMapServiceLayer, dynamicMapServiceLayer, poiMapServiceLayer]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because I was resizing the map after the dynamic layers were already added, it caused them to make unnecessary calls back to the server for the same image at load time. So basically I just decided to add the dynamic layers after the cached map was fully updated and drawn. This prevented them from re-requesting images.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope that makes sense. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eddie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2013 11:48:57 GMT</pubDate>
    <dc:creator>EdwardRozum</dc:creator>
    <dc:date>2013-10-10T11:48:57Z</dc:date>
    <item>
      <title>Dynamic Map requests same image consecutively</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191170#M17631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been tracking an issue at initial application load. When I add my dynamic map layer, it is making the exact same image call to the server twice consecutively. This only happens on the initial load of the map, when the layer is added. After that, the map calls are made as expected, which would be one image call per pan or zoom. Has anyone experienced this? Does anyone know what could trigger another map image request, not including a pan and zoom action. I have attached a screenshot of the request happening real time in fiddler. I will past the full urls of the requests below as well. I would appreciate any assistance in tracking down what exactly is happening. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eddie&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;51 200 HTTP vzwmaptest.verizonwireless.com /ArcGIS/rest/services/VZW_MOBILE_COV/MapServer/export?dpi=96&amp;amp;transparent=true&amp;amp;format=PNG8&amp;amp;layers=show%3A20&amp;amp;bbox=-14782321.297432182%2C2739888.6794155603%2C-6436620.801145716%2C6956766.655851042&amp;amp;bboxSR=102100&amp;amp;imageSR=102100&amp;amp;size=853%2C431&amp;amp;f=image 23,971 max-age=86400&amp;nbsp;&amp;nbsp; image/png firefox:6304&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;52 200 HTTP vzwmaptest.verizonwireless.com /ArcGIS/rest/services/VZW_MOBILE_COV/MapServer/export?dpi=96&amp;amp;transparent=true&amp;amp;format=PNG8&amp;amp;layers=show%3A20&amp;amp;bbox=-14782321.297432182%2C2739888.6794155594%2C-6436620.801145716%2C6956766.655851042&amp;amp;bboxSR=102100&amp;amp;imageSR=102100&amp;amp;size=853%2C431&amp;amp;f=image 23,971 max-age=86400&amp;nbsp;&amp;nbsp; image/png firefox:6304&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 11:49:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191170#M17631</guid>
      <dc:creator>EdwardRozum</dc:creator>
      <dc:date>2013-10-09T11:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Map requests same image consecutively</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191171#M17632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have narrowed the issue down to my custom resize map function. Because I am developing for mobile, I am resizing the map div after I determine device and screen size. I then call map.resize(); map.reposition(); to resize and position the map. This is where the multiple calls occur. The question I have now is, how do I determine when these two methods are finished? I tried adding a callback function to the resize map function that contains these two function calls, but that does not work. Is there an event or callback available for these functions? If not, how do I determine when the map is finished being resized and positioned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eddie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 15:02:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191171#M17632</guid>
      <dc:creator>EdwardRozum</dc:creator>
      <dc:date>2013-10-09T15:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Map requests same image consecutively</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191172#M17633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok guys, just in case anyone else ever has this problem, here is how I solved it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.) I attached an onUpdaetEnd event to my cached map layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.connect(map, "onUpdateEnd", addDynamicLayers);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.) I created a function that checked if this was the initial application load, then added the dynamic maps on top&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function addDynamicLayers() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isFirstRun) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayers([dynamicMapServiceLayer, poiMapServiceLayer]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isFirstRun = false;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Previously I added all layers at the same time in my init function as follows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.addLayers([cachedMapServiceLayer, dynamicMapServiceLayer, poiMapServiceLayer]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because I was resizing the map after the dynamic layers were already added, it caused them to make unnecessary calls back to the server for the same image at load time. So basically I just decided to add the dynamic layers after the cached map was fully updated and drawn. This prevented them from re-requesting images.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope that makes sense. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eddie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 11:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dynamic-map-requests-same-image-consecutively/m-p/191172#M17633</guid>
      <dc:creator>EdwardRozum</dc:creator>
      <dc:date>2013-10-10T11:48:57Z</dc:date>
    </item>
  </channel>
</rss>

